11

I, personally, use sp_restorecriptgenie by Paul Brewer. Here's the link to the SCC article that has it. Under 'The Procedure' http://www.sqlservercentral.com/articles/Restore+database/95839/ Basically, once you build the stored procedure, just run exec sp_restorescriptgenie and the script will go out and get all backups for every DB (even transaction logs) ...


9

Unattended installation is the way to go - as @ShawnMelton mentioned. To deploy CU on 100's of servers, you can explore below options (test them, so you know what will work for you and your environment) : Sysinternals - PsExec will allow you to spawn installation on remote machines. PowerShell - Use remoting feature in PowerShell 3.0 and up to perform ...


6

Honestly, the amount of time you'll spend writing a version of this that accounts for all possible combinations of indexes, constraints, and default values, and troubleshoot all the combinations you don't expect from your first use case, I don't think you'll ever get that time back no matter how many table types you have to script, which you can always do ...


5

I believe you can refer to ola.hallengren. SQL server Backup scripts. As stated on how to use for SQL server Express: SQL Server Express has no SQL Server Agent. Therefore, the execution of the stored procedures must be scheduled by using cmd files and Windows Scheduled Tasks. Follow these steps. Download MaintenanceSolution.sql. Execute ...


5

The reason the server wasn’t sending emails is due to this flag not being set: EXEC master..sp_altermessage 1205, 'WITH_LOG', TRUE; GO Even though it was logging in the event log via the trace flag, this also needs to set in order to trigger the emails. You can see the table here: select * from master.sys.messages where text like '%deadlock%'


5

If the database homes were installed properly, the central inventory has a list about them. The central inventory on Windows is located at C:\Program Files\Oracle\Inventory. On Linux/UNIX platforms, the location of the central inventory can be found in /etc/oraInst.loc. In the inventory, in ContentsXML\inventory.xml, there is a list of installed homes in XML ...


4

Provided that you have alerts set up on the jobs, Log Shipping is a feature that is available on all editions, doesn't require a whole lot of effort to set up, and I believe fulfills all of your requirements. I would avoid any wizards that you might stumble upon in Management Studio. Essentially you need three jobs for the following tasks: Initialize the ...


4

Another method to display the Oracle version is calling the dbv utility. This works only for database server installations. The version of this tool should always match to the version of the database. You should set the appropriate environment first (PATH; ORACLE_HOME, LD_LIBRARY_PATH), then you will get something like $ $ORACLE_HOME/bin/dbv DBVERIFY: ...


4

You can create a new job step at the end of the existing job that executes the "on-failure" job. You use the procedure sp_start_job to call this "on-failure" job. If the job fails, then have the on-failure action to execute that new job step. For this new step, make sure to set the on-success-action to "Quit the job reporting failure" so you know it failed.


4

Using commands with STATS_STREAM you are able to create exact copy of some statistics. It really useful for troubleshooting or for testing purposes when you want to repeat the query optimizer behavior on another table or even in another database. A great article on the option: Custom Built Statistics Using a command 'WITH FULLSCAN' you just update query ...


4

Rather than hack away at a script you don't understand well enough to troubleshoot, why not use something tested and understandable, like sp_BlitzIndex? If you run EXEC sp_BlitzIndex @Mode = 4, @GetAllDatabases = 1; it will go through and diagnose all sorts of index issues beyond what you're looking for in that Script You Found On The Internet™


4

I agree with Erik, but answering your question the error was in the quotation marks in the STUFF and here AND ISNULL (DUPE1.include_column_list, '') = ISNULL (DUPE2.include_column_list, '') You did not have the quotation marks correctly, remember that when you intermix texts all the '' must be like '' '' DECLARE @db_name AS nvarchar(max) DECLARE c_db_names ...


4

If it is scheduled, then getting it from the SQL Agent job's runtime duration is an option. And if you're using Ola's solution (which I'd recommend) then his dbo.CommandLog table has StartTime and EndTime columns for all the actions it performs, including DBCC work.


4

You can run "Installed SQL Server features discovery report" It is documented there: Validate a SQL Server Installation Some examples: how-to-find-out-what-sql-features-are-installed


3

The other answer is correct so just in case an example makes things clearer... CREATE TABLE T1 ( C1 VARCHAR(50), INDEX CIX CLUSTERED(C1) ); INSERT INTO T1 VALUES ('orange'), ('kiwi'), ('strawberry'); UPDATE STATISTICS [dbo].[T1]([CIX]) WITH STATS_STREAM = ...


3

I just removed the DB_Name from Grouping SELECT [Database Name] = DB_NAME(s.database_id), [Type] = CASE WHEN s.Type_Desc = 'ROWS' THEN 'Data File(s)' WHEN s.Type_Desc = 'LOG' THEN 'Log File(s)' ELSE s.Type_Desc END, LastUpdate= case when s.type_desc ='ROWS' then NULL when s....


3

If I think you want this in a SELECT statement for multiple databases, the below code is a good start CREATE TABLE #FileListHeaders ( LogicalName nvarchar(128) ,PhysicalName nvarchar(260) ,[Type] char(1) ,FileGroupName nvarchar(128) NULL ,Size numeric(20,0) ,MaxSize numeric(20,0) ,FileID bigint ,CreateLSN ...


3

When you create a login, it is granted CONNECT SQL. It has nothing to do with user. When you create a user, it does not automatically create a corresponding login, and CONNECT SQL is a server level permission that can be granted only to a server level principal, i.e. to login or a server role. The common use of this permission is the following: Suppose ...


3

Such a tool would be almost completely worthless in practical use. max_connections has nothing to do with performance. It's a safety mechanism to prevent a runaway application from making so many connections that the server becomes overwhelmed. The value makes absolutely no difference unless you are using that many connections. It is also a value that ...


2

There are two ways to do this. The more traditional way is with a cron job on the server: http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5 Another way is to do it with MySQL events: https://dev.mysql.com/doc/refman/5.6/en/events.html I personally prefer to keep this kind of logic in the app via a cron job and keep mysql events dedicated to db maintenance ...


2

there is a very good script on the link below: How to generate database restore script in SQL Server Based on that script I have created my stored procedure below, which works very well, although it does not generate the DBCC CHECKDB: it needs 3 parameters: @Database sysname - the database name you want to generate the restore @MovePathLog NVARCHAR(1008) ...


2

Other values and comments like DBNAMES suggest the syntax is a single pair of double quotes around a space separated list of DB names: DBEXCLUDES="DB1 DB2 DB3" Which is a syntax easy to handle for shell scripts.


2

Azure connections are encrypted (SSL/TLS) by default when connecting to Azure SQL Database although it is vulnerable to man-in-the-middle attack. You have many choices to increase security. You can use Transparent Data Encryption (TDE) as explained here. You can also use dynamic data masking, row-level security, Always Encrypted and Cell-level encryption. ...


2

Finding the job_id is not necessary if the job is named the same on all replicas. You can use the @job_name parameter, and never have to know the job_id. See this link for an example: https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-delete-jobstep-transact-sql. A more specific answer to your question is to use @job_id = N'...


2

One option (on MS Windows) is to create SQL file which spools data into a file create BAT script which calls that SQL script schedule a daily job in Task Scheduler Prerequisite is to install SQLPlus, if you don't have it already. PL/SQL Developer is a GUI tool; SQLPlus is a command-line tool. It can be installed via Oracle Client software, downloadable ...


2

can we get an output for list of databases which were not modified for last two months in a server and based on that we have to delete all of them. Regardless of what you may find on the internet, the only way to be 100% sure is to run an audit/trace/etc. against the servers and inspect the traffic that each database is receiving as some system processes ...


2

Unlike sys.server_principals and sys.database_permissions holds information about server level access/permissions, information similar to that sys.database_principals' andsys.database_permission` holds information about database level access/permissions. Joining these two objects with UNION of sys.objects and sys.sysobjects will give you desired information ...


2

To schedule a job to run once a month, in this case midnight on the first day: USE [msdb] GO BEGIN TRANSACTION DECLARE @ReturnCode INT SELECT @ReturnCode = 0 IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'[Uncategorized (Local)]' AND category_class=1) BEGIN EXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL', @name=...


2

It sounds like you are trying to process your tabular model (which is of version >= 1200) with XMLA script (so all in all command is in XML). That kind of tabular model has to be processed with JSON command. I had the same error message and it just turned out that I was trying to refresh the newer tabular model (of version >=1200) with XMLA command. After ...


Only top voted, non community-wiki answers of a minimum length are eligible