July 7, 2013 at 9:55 pm
Dear All,
I would like to have a backup of the SQL system databases (the files themselves) not the SQL backup.
When I try to copy these files (master,model,msdb,tempdb), it says the files is in use and it does not allow me to copy.
My clarifications:-
1) Without having to bring down the database, how can I copy these files to another location?
2) Is it possible to backup these files themselves during a full database backup? How do i perform that task?
Many thanks,
Jai
July 7, 2013 at 10:05 pm
without taking server offline it is not possible to move the system db's to another location.
July 7, 2013 at 10:14 pm
1. Backing up files that are in use is not an option. SQL Server caches data and that may mean that, even though your queries are showing a record, that does not mean that it is on disk. If you want to backup the actual files themselves, the only way you can do this is to stop the SQL Server service.
2. Using a database backup is the only way to backup a SQL Server database whilst it is being used by SQL Server. Have a look at the backup command (http://msdn.microsoft.com/en-us/library/ms186865.aspx) or maintenance plans (http://msdn.microsoft.com/en-us/library/ms187658.aspx)
July 8, 2013 at 1:51 am
mJai (7/7/2013)
I would like to have a backup of the SQL system databases (the files themselves) not the SQL backup.
Why would you want a copy of the files themselves? Why does a SQL backup not satisfy your needs?.
When I try to copy these files (master,model,msdb,tempdb), it says the files is in use and it does not allow me to copy.
When SQL Server is started, it locks all the files of all the databases on that instance.
My clarifications:-
1) Without having to bring down the database, how can I copy these files to another location?
No file copy is possible. Only way to do this is with a (native or third party) SQL backup.
2) Is it possible to backup these files themselves during a full database backup? How do i perform that task?
When you create a SQL full backup of a database (see: http://msdn.microsoft.com/en-us/library/ms186865(v=sql.105).aspx), the complete database is being backupped. With a restore the database is being placed on the destination instance and you can specify where the database files are are being placed.
July 8, 2013 at 2:02 am
HanShi (7/8/2013)
mJai (7/7/2013)
I would like to have a backup of the SQL system databases (the files themselves) not the SQL backup.Why would you want a copy of the files themselves? Why does a SQL backup not satisfy your needs?.
Because it's damn handy to have copies of those files (well, master and model) in case there's any problems with the system databases. It's far easier to switch in known-to-be working files, start SQL then restore backups than to go through the hoops required to get SQL started with damaged/missing system files.
Not instead of database backups. As well as.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 8, 2013 at 3:14 am
absolutely. copies of system files saves the database when it comes to a reality 🙂
I have heard that it is possible to actually have a copy of those files(system), triggered during a SQL backup using certain switches. I was hoping someone must have surely used that method. Thanks.
July 8, 2013 at 3:18 am
Try This..
1.Turn ON the Auto-Close option for databases
2.Kill all connections
and then try to copy the files
July 8, 2013 at 3:30 am
Ratheesh.K.Nair (7/8/2013)
Try This..1.Turn ON the Auto-Close option for databases
2.Kill all connections
and then try to copy the files
He's talking about the system databases, not user databases...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 8, 2013 at 3:31 am
mJai (7/7/2013)
When I try to copy these files (master,model,msdb,tempdb), it says the files is in use and it does not allow me to copy.
You don't need the TempDB files. Master and model are the ones that are useful to have file copies of, msdb just make sure you have good backups.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 10, 2013 at 7:57 am
Hmm...Looks like theres no way to get a copy of these files (model and master) without bringing the database down first!
July 10, 2013 at 8:48 am
Without shutting SQL Server down, you cannot copy the files of the system databases.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 12, 2013 at 2:57 am
Thanks!
July 12, 2013 at 3:13 am
Take a sql backup of system database. Try to restore them in another instance with different database name.
Then deattach and copy the mdf, ldf file.
But I did not test this. 😛
July 14, 2013 at 9:06 pm
Thanks, This is what i did the last time when the master corrupted.
July 15, 2013 at 5:44 pm
Do a set of system file backups (bak), then the next time you can stop the SQL Service, make copies of the MDF & LDF files.
I wouldn't trust a master database on Server1 after it had been restored to a Server2, even under a different name.
Viewing 15 posts - 1 through 15 (of 16 total)
You must be logged in to reply to this topic. Login to reply