To rename a database first get the database into Single user mode .
By using the query below ( run these query in query analyzer)
ALTER DATABASE database_name SET SINGLE_USER WITH ROLLBACK IMMEDIATE
then rename the database using following query
SP_RENAMEDB 'old db_name', 'new db_name'
then change the access mode of the database to multiuser mode
ALTER DATABASE new_database_name SET MULTI_USER
Thursday, June 28, 2007
Tuesday, June 19, 2007
Suspect status of a database in SQL Server
SQL Server gives a database 'suspect' status when it is unable to recover the database .
Reasons may be many , may be a torn page detection , may be datafile location no found.
SQL Server pages are 8KB. Windows 2000 disk I/O operations, however, use 512 byte sectors. If an unexpected outage or power failure occurs, a 'torn' page can result, with the 8KB-page write not completely written. Enabling the TORN_PAGE_DETECTION option allows SQL Server to detect incomplete I/O operations. If a torn page occurs when the database is online, an I/O error is raised and the connection is killed;
Friday, June 15, 2007
Enable and Disable Trigger
In SQL Server 2000 there are some undocumented functions or statements which cannot be seen in Books Online.
Some of them are :
Enable and Disable Trigger
ALTER TABLE tablename ENABLE/DISABLE TRIGGER triggername
Some of them are :
Enable and Disable Trigger
ALTER TABLE tablename
Subscribe to:
Posts (Atom)