Finally I got the chance to work on rebuild
system database in SQL Server 2012.
To rebuild the system database is the last
preference from my side.
Why we need to rebuild the System database
and when?
Situation:-
When your Master database corrupt and you
are not able to start SQL Server .
Here is two type of corruption for Master
database:-
1)
Partial corrupt
Partial corrupt means: -
There are few pages corrupted from Master database not full database. So, if
you are able to connect Instance by single user mode means its partial corrupt and you can restore
the last backup copy from backups and it will start normally.
2)
Fully Corrupt
Fully corrupt: Fully corrupt
means you are not able to restart SQL Server in single user mode and there is
no other way to rebuild Master databases.
To rebuild a System
databases is a complicated process so before go to rebuild Master database we
can try other method through we can start our SQL Server Instance.
So solution is if you have
any other instance running or any other Server with the same edition and build
number we can stop that Server and copy the Master database .LDF and MDF files
and Paste these files against corrupted Server and restart the server .98 % it
will we up and work but may be you will lose your login and user but that also we
can recover if we have last full backup of Master database so just restore that
database with single user mode and it will work you can recover all the data
now.
If there is no other
Instance with the same edition or you are not able to start SQL Server with other
SQL Server Master .Ldf and .mdf file ,so last way is rebuild the system
databases.
Precaution before rebuild
the System Databases:-
1)
Take backup for all the user
and system database backup by copy and paste .mdf and ldf file data file and
keep it some safe place.
Why these backup are
mandatory before rebuild the system database?
Whenever we rebuild the system database it will recreate
all the system database from scratch and if you didn’t take backup of other database like MSDB,
model and user database ,so we can lose the important information and data like
all jobs related information from MSDB database and some property feature if we
setup in model database for every new creation of DB and during rebuild the
system database sql server remove all the user databases so make sure we need
to take all backup before rebuild system databases.
So I hope now you will understand the importance of keep
backup before rebuild system databases.
Let start with Re-build process:-
Step 1:- Go To >>Programe
Files>>Microsoft SQL Server>>110>>Setup
Bootstrap>>SQlServer2012>>Setup.exe
Step 2:-
Open CMD by RUN as Administrator
Type below command
C:\Program Files\Microsoft SQL
Server\110\Setup Bootstrap\SQLServer2012
Step 3:-
setup.exe /QUIET /ACTION=REBUILDDATABASE
/INSTANCENAME=SQlServer2012 /SQLSYSADMINACCOUNTS=Ashish-PC\Ashish /SAPWD=123456
Done!
No comments:
Post a Comment