RESTORE LOG [corporate_log]
FROM DISK = N'\\10.0.1.83\dba\logship\dbname\filename.trn'
WITH FILE = 1
,STANDBY = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Backup\ROLLBACK_UNDO_dbname.BAK'
,NOUNLOAD
,STATS = 10
Tips and scripts relating to database administration. Mainly SQL Server but some MySQL and every now and again something different. Posts are brief and to the point.It's as much a place to make notes for my own use as anything else.
Thursday, 26 July 2012
Transaction Log Restore
The following statement can be used to restore a transcation log back up and keep the database on standby as read only.
Thursday, 19 July 2012
MySQL Script all Stored Procedures
The following will generate a script to recreate all stored procedures and functions for all MySQL databases in an instance.
mysqldump -u username -p -h servername --routines --no-create-info --no-data --no-create-db --skip-opt --all-databases > outputfile.sql
To recreate the routines on another server run the following:
mysql -u username -p -h servername < outputfile.sql
To view all stored procedures and functions use the following commands:
SHOW PROCEDURE STATUS
SHOW FUNCTION STATUS
Friday, 13 July 2012
Adding a Linked Server
DECLARE @Server sysname
SET @Server = 'LINKED_SERVERNAME'
EXEC sp_addlinkedserver @Server , @srvproduct = N'' , @provider = N'SQLOLEDB' , @datasrc = N'10.0.1.70'
EXEC sp_serveroption @Server, N'data access', N'true'
EXEC sp_serveroption @Server, N'rpc out', N'true'
EXEC sp_serveroption @Server, N'rpc', N'true'
EXEC sp_serveroption @Server, N'use remote collation', N'true'
EXEC sp_serveroption @Server, N'collation name', N'null'
EXEC sp_serveroption @Server, N'connect timeout', 0
EXEC sp_serveroption @Server, N'query timeout', 0
EXEC sp_addlinkedsrvlogin @Server, 'false', null, 'username', 'password'
Subscribe to:
Comments (Atom)