Anda di halaman 1dari 6

Log shipping Interview Questions

Question: What is Log Shipping Essentially, log shipping is the process of automating the backup of database and transaction log files on a production SQL server, and then restoring them onto a standby server. But this is not all. The key feature of log shipping is that is will automatically backup transaction logs throughout the 3 (for whatever interval you specify) and automatically restore them on the standby server. This in effect keeps the two SQL Servers in "synch". Should the production server fail, all you have to do is point the users to the new server, and you are all set. Well, its not really that easy, but it comes close if you put enough effort into your log shipping setup.

Question : IS it possible to log ship database between SQL 2000 & SQL 2005?
Answer: No, thats impossible, In SQL 2005 transaction log architecture is changed compared to SQL 2000 and hence you won't be able to restore tlog backups from SQL 2000 to SQL 2005 or vice versa.

Question:I'm getting the below error message in restoration job on secondary server, WHY?

[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 4305: [Microsoft][ODBC SQL Server Driver][SQL Server]The log in this backup set begins at LSN 7000000026200001, which is too late to apply to the database. An earlier log backup that includes LSN 6000000015100001 can be restored. [Microsoft][ODBC SQL Server Driver][SQL Server]RESTORE LOG is terminating abnormally. Answer:Was your sql server or agent restarted Y'day in either source or destination ? because the error states there is a mismatch in LSN. A particular tran log was not applied in the destination server hence the subsequent tran logs cannot be applied as a result ! You can check log shipping monitor \ log shipping tables to check the which transaction log is last applied to secondary db, if the next consecutive transaction logs are available in the secondary server share folder you manually RESTORE the logs with NORECOVERY option, Once you restored all the logs automatically from the next cycle the job will work fine.

Incase if you are not able to find the next transaction log in secondary server shared folder, you need to reconfigure log shipping. Try the below tasks to reestablish log shipping again.
o

Disable all the log shipping jobs in source and destination servers o Take a full backup in source and restore it in secondary server using the With Standby option o Enable all the jobs you disabled previously in step1 Question: Is it possible load balance in log shipping?
Answer:Yes ofcourse its possible in log shipping, while configuring log shipping you have the option to choose standby or no recovery mode, there you select STANDBY option to make the secondary database readonly.

Question: Can I take full backup of the log shipped database in primary server??
Answer: In SQL Server 2000 you won't be able to take full backup of log shipped database, because this will break the LSN chain and it directly affects the log shipping. In SQL Server 2005, yes its possible. You can take full backup of log shipped database and this won't affect the log shipping.

Question : Can I shrink log shipped database log file??


Answer: Yes ofcourse you can shrink the log file, but you shouldn't use WITH TRUNCATE option. If you use this option obviously log shipping will be disturbed.

Question : Can I take full backup of the log shipped database in secondary server??
Answer: No chance , you won't be able to execute BACKUP command against a log shipped database in secondary server.

Question: I've configured Log shipping successfully on standby mode, but in the restoration job I'm getting the below error. What I do to avoid this in future??
Message 2006-07-31 09:40:54.33 *** Error: Could not apply log backup file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\LogShip\TEST_20060731131501.trn' to secondary database 'TEST'.(Microsoft.SqlServer.Management.LogShipping) *** 2006-07-31 09:40:54.33 *** Error: Exclusive access could not be obtained because the database is in use. RESTORE LOG is terminating abnormally.(.Net SqlClient Data Provider) ***

Answer: To restore transaction logs to the secondary db, SQL Server needs exclussive access on the database. When you configure it in standby mode, users will be able to access the database and runs query against the secondary db. Hence If the scheduled restore jobs runs at that time, the db will have a lock and it won't allow SQL Server to restore the tlogs. To avoid this you need to check "Disconnect users in the database when restoring backups" options in log shipping configuration wizard.

Question : Suddenly I'm getting the error below, How can I rectify this??? [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 4323: [Microsoft][ODBC SQL Server Driver][SQL Server]The database is marked suspect. Transaction logs cannot be restored. Use RESTORE DATABASE to recover the database. [Microsoft][ODBC SQL Server Driver][SQL Server]RESTORE LOG is terminating abnormally
Answer : We had the same issue some time ago, this was related to a new file being created in a filegroup on the source. Don't know if this applies to your case, but restoring a backup of this new file on the secondary server solved the problem.

Question : Is it possible to log ship database from SQL server 2005 to SQL server 2008 and vice versa?
Answer : Yes you can log ship database from SQL server 2005 to SQL Server 2008 this will work. However log shipping from SQL Server 2008 to SQL Server 2005 is not possible because you wont be able to restore SQL server 2008 backup to SQL Server 2005 (downgrading version).

Question:Benefits of Log Shipping


While I have already talked about some of the benefits of log shipping, let's take a more comprehensive look: Log shipping doesn't require expensive hardware or software. While it is great if your standby server is similar in capacity to your production server, it is not a requirement. In addition, you can use the standby server for other tasks, helping to justify the cost of the standby server. Just keep in mind that if you do need to fail over, that this server will have to handle not one, but two loads. I like to make my standby server a development server. This way, I keep my developers off the production server, but don't put too much work load on the standby server. Once log shipping has been implemented, it is relatively easy to maintain. Assuming you have implemented log shipping correctly, it is very reliable. The manual failover process is generally very short, typically 15 minutes or less. Depending on how you have designed your log shipping process, very little, if any,

data is lost should you have to failover. The amount of data loss, if any, is also dependent on why your production server failed. Implementing log shipping is not technically difficult. Almost any DBA with several months or more of SQL Server 7 experience can successfully implement it.

Question: Problems with Log Shipping


Let's face it, log shipping is a compromise. It is not the ideal solution, but it is often a practical solution given real-world budget constraints. Some of the problems with log shipping include: Log shipping failover is not automatic. The DBA must still manually failover the server, which means the DBA must be present when the failover occurs.

The users will experience some downtime. How long depends on how well

you implemented log shipping, the nature of the production server failure, your network, the standby server, and the application or applications to be failed over. Some data can be lost, although not always. How much data is lost depends on how often you schedule log shipping and whether or not the transaction log on the failed production server is recoverable. The database or databases that are being failed over to the standby server cannot be used for anything else. But databases on the standby server not being used for failover can still be used normally. When it comes time for the actual failover, you must do one of two things to make your applications work: either rename the standby server the same name as the failed production server (and the IP address), or re-point your user's applications to the new standby server. In some cases, neither of these options is practical.

Question:Log Shipping Overview


Before we get into the details of how to implement log shipping, let's take a look at the big picture. Essentially, here's what you need to do in order to implement log shipping: Ensure you have the necessary hardware and software properly prepared to implement log shipping. servers. Create two backup devices. One will be used for your database backups and On the production server, create a linked server to your standby server. On the standby servers, create two stored procedures. One stored the other will be used for your transaction log backups. Synchronize the SQL Server login IDs between the production and standby

procedure will be used to restore the database. The other stored procedure will be used to restore transaction logs. On the production server, create two SQL Server jobs that will be used to perform the database and transaction log backups. Each job will include multiple steps with scripts that will perform the backups, copy the files from the production server to the standby server, and fire the remote stored procedures used to restore the database and log files. Start and test the log shipping process. Devise and test the failover process. Monitor the log shipping process.

Cold & Hot Backup:

Cold and Hot Backup


Backup and Restore
Oct

022011

There are always a chance databases suffering from severe system failure and hence causes database corruption, for instance, memory failure, hard drive failure, power failure and so on. Once the database gets corrupted, its almost hopeless to recover it without backup. So its very important to backup the databases for any database systems. There are two big categories in backup world cold backup and hot backup. Cold backup is to use operating system command to backup the database. In this case, SQL Server could not hold exclusive locks to the database file. In following circumstances you could do cold backup

1. When SQL Server service is off, you are free to do cold backup. 2. While a database is taking offline 3. When a database is set to read-only in SQL Server 2005/2008 4. When a database is detached 5. Resource database in SQL Server 2005/2008 while SQL Server is running 1. For resource database, you could only do cold backup. 6. You could backup tempdb but you have to shut down the SQL Service and the database will be recreated every time when the server starts up. 1. You may fail to attach tempdb files with difference name when there are any encrypted database before shutting down the server. Another approach is hot backup(again, it has nothing to do with the tempdb). Hot backup allows the end user to backup the database while it is running. A full back first of all executes checkpoint to flush the data from buffer manager to data file and mark the start LSN. Then scans and copies the pages in database data files to specified backup file regardless changes on backed up pages or unbacked up pages. After the data is copied, the backup process will record the end LSN. Before this point, the data in the backup file is logical and/or transactional inconsistent. Last step, it will copy transaction logs to the backup file. Please look at the illustration below, while backing a database, the system can process the user requests without waiting. In order to make the backup transactional to be consistent, all the transaction logs from Start to End will be saved.

While restoring a backup, fist of all, SQL Server will create database file and initialize it if there isnt files (tip, dont drop the database files before restoring). And then, it copies the data and transaction logs from the backup file. The third is to redo the transactions. In the illustration above, the Trans1 and Trans2 will be redone. This means that the data being modified by Trans1 and Trans2 will appear in the restored database. After this point, the database is accessible in SQL Server 2005 and 2008. The last step is to undo the transaction. Transactions havent been committed/rolled back after the backup started but before the end of the backup will be rolled back. In the example above, Tran3 and Tran4 will be rolled back. Backup a database: Backup database DatabaseName to disk = d:\DatabaseName.bak Restore a database: Restore database DatabaseName from disk = d:\DatabaseName.bak For more information regarding syntax, please check with book online. Backup:http://msdn.microsoft.com/enus/library/ms186865.aspx Restore: http://msdn.microsoft.com/en-us/library/ms186858.aspx Other resource: http://www.sqlskills.com/blogs/paul/category/BackupRestore.aspx

Anda mungkin juga menyukai