We ended up using a combination of SSMS script generation to extract schema and data, and then use our own database tool which allows keyword parsing and token based replacement in scripts. It also ensures scripts are only applied once. • We need to support installations on SQL Server 2000, 2005 and 2008, and there are changes to data types between versions, e.g. 2005+ have nvarchar(max), whereas 2000 only supports ntext. So our scripts use a token and based upon the db choice replaces with the correct type. • Execution of some scripts requires a wait period after execution, e.g. We found if you didn't wait a few seconds after creating a new databases via a script, the SQL Server might fail sometimes (because it hasn't had time to create the db files) when it went on to create tables, etc. Autocad 2010 Product key + Serial Number + Crack Autocad 2010 Product key is required for installation of Autodesk merchandise and are used to differentiate products that are each sold independently and as part of a product suite. For instance, installing AutoCAD 2010 as a point product requires product key 001B1, but installing AutoCAD 2010 from the AutoCAD Revit Architecture Suite 2010 requires product key 241B1. Product key for autocad 2010 free download. The latest Tweets from Screenplay Database (@ScreenplayDB). Movie and television script repository. Building a Database of Agents, Managers and Producers. By Ashley Scott Meyers. Next post: Sending Your Screenplay Query Letter to Your Database of Contacts. Search the movie script database by title or author. Advanced Script Search. Featured Links. Creative Screenwriting Magazine - 'Best Screenwriting Magazine' LA Times; www.aTalentScout.com - - The talent management company focused on finding and promoting new writing talent. UK Telly US Drama. US Animation. Hello, Writers! This site will be of plenty of interest to TV fans, but fundamentally it's for people who want to take their love of TV and transform it into something more practical: actually creating telly that people want to see. These scripts are here. • We wanted to maintain a history of what scripts were executed and when. • We wanted to allow our Wix MSI installer to specify connection string and credentials, and needed some way to pass these into the scripts, so once again, using tokens and some conditional logic. Example script (edited for brevity) -- Sleep: 5 -- Sleep after creating database to allow file system to create db files CREATE DATABASE [$Database$] GO EXEC sp_dbcmptlevel [$Database$], $CompatabilityLevel$ GO USE [$Database$] GO IF '1'!='$IntegratedSecurity$' BEGIN CREATE LOGIN [$Login$] WITH PASSWORD=N'$Password$', DEFAULT_DATABASE=[$Database$] CREATE USER [$User$] FOR LOGIN [$Login$] EXEC sp_addrolemember N'db_owner', N'$User$' END GO. You may not have DBA in your job title but you and I both know that you’re the person responsible for the database, and you might as well have that title. You might consider yourself an accidental DBA, a reluctant DBA, an incidental DBA or even a forced DBA, but somehow you managed find your way to a place where you’re the person responsible for the local instance of SQL Server. You could probably use a little help now that you’ve arrived. There is a lot of documentation out there describing how to set up your backups or maintain your databases, indexes, statistics, logs, and so on, and much of this work will be automated. However, what about the day-to-day T-SQL commands that you’re just going to have to run manually, over and over? I took the following question online through various forums: What are the top 5 T-SQL commands, scripts, or fragments that you have typed so often that they are now second nature? I received many responses, and a pretty good collection of scripts. I also requested everyone to nominate scripts that used native commands only, and not their favorite third-party script or tool. A few, very clear winners rose to the top, and here are the top 10: • sp_who2 / sys.dm_exec_requests / sp_whoisactive • STATISTICS IO/TIME • BACKUP DATABASE • sp_help • DBCC SQLPERF • sys.dm_exec_query_stats • R ESTORE DATABASE • RESTORE FILELISTONLY • sp_spaceused • DBCC SHOW_STATISTICS If you’re just getting started as a DBA, accidental or otherwise, these are the ones you should start memorizing now, because you’re going to need them frequently. My article shows how to create a set of DBA snippets from these scripts, so you can run each of them with one or two simple keystrokes. #1 sp_who2 / sys.dm_exec_requests / sp_whoisactive For several reasons, I lumped these three scripts together. While I was very explicit in asking people not to nominate third party scripts, Adam Machanic’s kept showing up over and over again, so I decided that I couldn’t very well keep it off the list. The sp_whoisactive script uses various DMVs to investigate current activity on the system. It will highlight, among other things, which queries are running long and where you might be experiencing blocking. Under the covers, it makes use of the Dynamic Management View (DMV), so I decided to keep them together. The tool sp_who2 represents the ‘old way’ of looking at current activity on the system, and I’m including it here too mainly because I want people to stop using it. Instead, use sys.dm_exec_requests and the associated DMVs to find this information (or sp_whoisactive). There are lots of ways to put together information out of these DMVs. Here’s one example that shows you what’s currently running on the system, the query text and the execution plan. ![]() CPU time = 0 ms, elapsed time = 321 ms. Focus are on the ‘logical reads’ for each of the tables referenced and on the ‘elapsed time’ for the query. #3 BACKUP DATABASE I’m not even remotely surprised that made the list; in fact, I expected it to be the #1 query, rather than #3. While you’re going to automate your production database backups so that they run without your direct intervention, it’s extremely common to need to create a few extra database backups. For example, you might want a ‘fallback’ option before be deploying new objects to your database, or to create a copy of the QA database for some additional testing. WITH COPY_ONLY; Listing 4 This is a straight forward database backup command. The only wrinkle I’ve added is to use the WITH COPY_ONLY clause. Since this is an ad hoc backup, I don’t want to interfere with any DIFFERENTIAL backups that might run subsequently. Only a very few people listed BACKUP LOG as a commonly run command. Screenplay Database OnlineThis is probably because it’s just not something that a lot of people do manually, so it’s not one that comes to mind when talking about common scripts. #4 sp_help Based on how often sp_help came up in the survey, a lot of people spend a lot of time in databases that they probably didn’t design or build themselves. And its series of associated commands, such as sp_helpdb, sp_helpindex, and sp_helpfile, allow us to gather information about the target object. Running sp_help on different objects will result in different result sets, showing varying amounts of details for those objects. For example, Listing 5 will run sp_help on a table. Sp_help 'Sales.SalesOrderHeader'; Listing 5 This command returns quite a lot of information about the table, as you can see in Figure 1. Internet Movie Script DatabaseFigure 1 You can see the basics right at the top, describing the table in question, the table owner and data the table was created. Below that, you start seeing details. The second section shows the columns, such as the IDENTITY column and its definition. Storage, indexes and constraints are all detailed, and finally information about which foreign keys reference this table. If you’re not sure about a database or its design, sp_help is a quick, easy, and most importantly programmatic way to identify details about the objects within it. #5 DBCC SQLPERF Most DBAs have been taken by surprise, at one time or another, by extremely rapid growth in the size of the transaction log. Script DatabaseIt can be cause by lack of log backups, or infrequent log backups, or by some other problem, such as a long running or orphaned transaction that is preventing reuse of existing log space. Shows the size of the log for each database and the percentage of log space that is currently in use. This quickly allows you to assess which databases might need more log space, how much log space is currently in use, and if any are just too big. Putting it to work is easy. The Screenplay DatabaseGO Listing 7 Just remember, this resets these statistics completely to zero, so you won’t have any historical track from the moment you run the above commands. #6 sys.dm_exec_query_stats If sys.dm_exec_requests is the place to go to find out what requests are running on the server right now, then sys.dm_exec_query_stats is where you’ll find aggregated, server-wide data summarizing previous activity. It shows aggregations of performance metrics on statements within queries, procedures and batches. However, this information is only retained on the queries that are currently stored in cache. As soon as the query leaves the cache, this information goes away completely. If the query comes back into cache, it starts over at scratch gathering its metrics. You use this DMV in similar ways to sys.dm_exec_requests. CROSS APPLY sys. Dm_exec_query_plan ( deqs. Plan_handle ) AS deqp; Listing 8 Queries against sys.dm_exec_query_stats, especially when combined with other DMVs, can provide meaningful and useful information, but just remember that these are aggregates, so it won’t show individual parameter values or row counts or other results related to individual executions of the query. You can also look to sys.dm_exec_procedure_stats to see the same kind of information on stored procedures. #7 RESTORE DATABASE On the one hand, I’m rather shocked to see so far down the list. On the other hand, when I think about the number of backups I have done versus the number of times I’ve used those backups to restore a database, it makes sense. On the gripping hand, I’m not surprised that it made the list because we’ve all had to restore a backup or three.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |