Database query or only MDF file information

Source: Internet
Author: User

--Allow the operation of system tables

Use master

DECLARE @databasename varchar (255)

Set @databasename = ' Blwy BarCode '

--1. If the user library does not start, open the SQL Server Analysis Finder and execute the following command

EXEC sp_configure ' Allow update ', 1 reconfigure with override

--2. Setting up the database to emergency mode

UPDATE sysdatabases set status=-32768 where dbid=db_id (@databasename)

--3. Creating a log file DBCC REBUILD_LOG (@databasename, ' D:\Blwy barcode_log.ldf ')

--4. Modify only allow dbo access to the--sp_dboption @databasename, ' dbo use only ', ' false '

--5. Verifying database consistency

DBCC CHECKDB (@databasename)

--6. The 5th step fails, the

exec sp_dboption @databasename, n ' single ', n ' true '--to place the target data base in single-user mode

DBCC CHECKDB (@databasename, Repair_allow_data_loss)

DBCC CHECKDB (@databasename, Repair_rebuild)

exec sp_dboption @databasename, n ' single ', n ' false '--to set the target data base to multi-user mode

--7. Emergency mode for recovering a database

Update sysdatabases set status=0 where [email protected]
--8. Settings for restoring system table operations

exec sp_configure @databasename, 0 reconfigure with override

Database query or only MDF file information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.