Beruflich Dokumente
Kultur Dokumente
LS
1.
2.
3.
4.
5.
6.
3. The next step is to configure and schedule a transaction log backup. Click on Backup
Settings to do this.
If you are creating backups on a network share enter the network path or for the local
machine you can specify the local folder path. The backup compression feature was
introduced in SQL Server 2008 Enterprise edition. While configuring log shipping, we can
control the backup compression behavior of log backups by specifying the compression
option. When this step is completed it will create the backup job on the Primary Server.
4. In this step we will configure the secondary instance and database. Click on
the Add button to configure the Secondary Server instance and database. You can add
multiple servers if you want to setup one to many server log-shipping.
When you click the Add button it will take you to the below screen where you have to
configure the Secondary Server and database. Click on the Connect button to connect to
the secondary server. Once you connect to the secondary server you can access the three
tabs as shown below.
Initialize Secondary Database tab
In this step you can specify how to create the data on the secondary server. You have three
options: create a backup and restore it, use an existing backup and restore or do nothing
because you have manually restored the database and have put it into the correct state to
receive additional backups.
5. In this step we will configure Log Shipping Monitoring which will notify us in case of any
failure. Please note Log Shipping monitoring configuration is optional.
Click on Settings button which will take you to the Log Shipping Monitor
Settings screen. Click on Connect button to setup a monitor server. Monitoring can be
done from the source server, target server or a separate SQL Server instance. We can
configure alerts on source / destination server if respective jobs fail. Lastly we can also
configure how long job history records are retained in the MSDB database. Please note that
you cannot add a monitor instance once log shipping is configured.
6. Click on the OK button to finish the Log Shipping configuration and it will show you the
below screen.
You need to perform the final log backup using the NORECOVERY option. Backing up the log
with this option puts the database in a state that allows log backups to be restored and
ensures that the databases LSN chain doesnt deviate.
The primary log shipping server must still be accessible to use this technique.
To fail over to a secondary log shipping server, follow this 10-step process:
1. Disable all backup jobs that might back up the database on both log shipping partners.
With a few minor adjustments, this 10-step process works with multiple secondary log
shipping databases. You perform the same basic steps, keeping in mind that the other
secondary databases will still be secondary databases after the failover. After you back up
the log on the new primary database, you should use the NORECOVERY option to restore
that backup on all the planned secondary databases. You can then add them as secondary
databases to the new primary database.
3. Is it possible configuration of log shipping without domain?
You could try to move the logs using FTP then you don't need a domain account for the copy
just FTP access
4. What is TUF?
A:
TOUF file is known as transaction undo file
This file is created when logshipping is configured in SQL Server
This is consists of list of uncommitted transactions while backup is going on the primary
server in logshipping.
if this is deleted you have to reconfigure the logshipping as the secondary server.
This file is located in the path where transaction log files are saved.
.TUF file is the Transaction Undo File, which is created when performing log shipping to a
server in Standby mode.
When the database is in Standby mode the database recovery is done when the log is
restored; and this mode also creates a file on destination server with .TUF extension which
is the transaction undo file.
This file contains information on all the modifications performed at the time backup is taken.
The file plays a important role in Standby mode the reason being very obvious while
restoring the log backup all uncommited transactions are recorded to the undo file with only
commited transactions written to disk which enables the users to read the database. So
when we restore next transaction log backup; SQL server will fetch all the uncommited
transactions from undo file and check with the new transaction log backup
whether commited or not.
If found to be commited the transactions will be written to disk else it will be stored in undo
file until it gets commited or rolledback.
5. What is TUF file?
The transaction undo file contains modifications that were not committed on the source
database but were in progress when the transaction log was backed up AND when the
log was restored to another database, you left the database in a state that allowed
addition transaction log backups to be restored to it (at some point in the future. When
another transaction log is restored, SQL Server uses data from the undo file and the
transaction log to continue restoring the incomplete transactions (assuming that they
are were completed in the next transaction log file). Following the restore, the undo file
will be re-written with any transactions that, at that point, are incomplete.
TUF file is known as "Transaction Undo File"
This file is created when LogShipping is configured in SQL Server.
This file consists of list of uncommitted transactions while backup is going on the primary
server in Log Shipping.
If this file is deleted you have to reconfigure the LogShipping as the secondary server.
This file is located in the path where transaction log files are saved.
TUF File: Its Transaction Undo File. It Generated only when you Have Configured
Log Shipping With Stand by Option. Since In Stand by Log Shipping Secondary Database is
Available to User. So TUF Keep Pending Transaction Which are in Log File Came from Primary
So That when Next Log Backup Will Come From Primary They Can Be Synchronized At
Secondary.
.WRK : This Extension Is Given To A File Which is Being Copied From Primary
Backup Location to Secondary and Once Copy Process has been completed these file are
renamed with .trn file.
6. Today I faced an issue where one of secondary server box is now not available due to some circumstances, now I have to delete
this secondary server Name and Database entry from primary servers database. If we go through log shipping wizard from
Database property page and try to remove secondary server it will ask to connect secondary server but in my case secondary
server is now not available with us. To resolve this, here is a script to delete secondary server entry from primary servers database
is: ( in this case there is no need to connect secondary server)
EXEC Master.dbo.sp_delete_log_shipping_primary_secondary
@primary_database = NVirendraTest,
@secondary_server = NVIRENDRA_PC,
@primary_database =NLSVirendraTest;
GO
Disable all the log shipping jobs in source and destination servers
Take a full backup in source and restore it in secondary server using the With Standby
option
Enable all the jobs you disabled previously in step1
Question: Can I take full backup of the log shipped database in primary server??
Answer: In SQL Server 2000 you wont 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 wont affect the log shipping.
Answer: Yes ofcourse you can shrink the log file, but you shouldnt 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 wont be able to execute BACKUP command against a log shipped
database in secondary server.
Question: Ive configured Log shipping successfully on standby mode, but in the
restoration job Im 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 wont 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. Check the link 10 Steps to configure Log Shipping.
Question : Can you tell me the pre-requisites for configuring log shipping??
Answer : Check out the link Pre-requisites for Log Shipping.
Question : Suddenly Im 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. Dont 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)
Q. Can we hot add CPU to sql server?
Ans:
Yes! Adding CPUs can occur physically by adding new hardware, logically by online hardware partitioning, or
virtually through a virtualization layer. Starting with SQL Server 2008, SQL Server supports hot add CPU.
Once the CPU is added just run RECONFIGURE then sql server recognizes the newly added CPU.
Q: How can we check whether the port number is connecting or not on a Server?
Ans:
TELNET <HOSTNAME> PORTNUMBER
TELNET PAXT3DEVSQL24 1433
TELNET PAXT3DEVSQL24 1434
Common Ports:
MSSQL Server: 1433
HTTP TCP 80
HTTPS TCP 443
Q: What is the port numbers used for SQL Server services?
Ans:
The default SQL Server port is 1433 but only if its a default install. Named instances get a random port
number.
Reporting services is a web service so its port 80, or 443 if its SSL enabled.
Analysis service is on 2382 but only if its a default install. Named instances get a random port number.
Q: Start SQL Server in different modes?
Ans:
Single User Mode (-m) : sqlcmd m d master S PAXT3DEVSQL11 c U sa P *******
DAC (-A): sqlcmd A d master S PAXT3DEVSQL11 c U sa P *******
Emergency: ALTER DATABASE test_db SET EMERGENCY
Q: How to recover a database that is in suspect stage?
Ans:
ALTER DATABASE test_db SET EMERGENCY
After you execute this statement SQL Server will shutdown the database and restart it without recovering it. This
will allow you to view / query database objects, but the database will be in read-only mode. Any attempt to
modify data will result in an error similar to the following:
Msg 3908, Level 16, State 1, Line 1 Could not run BEGIN TRANSACTION in database test ..etc
ALTER DATABASE test SET SINGLE_USER
GO
DBCC CHECKDB (test, REPAIR_ALLOW_DATA_LOSS) GO
If DBCC CHECKDB statement above succeeds the database is brought back online (but youll have to place it in
multi-user mode before your users can connect to it). Before you turn the database over to your users you should
run other statements to ensure its transactional consistency. If DBCC CHECKDB fails then there is no way to repair
the database you must restore it from a backup.
Q. Can we uninstall/rollback a service packs from SQL Server 2005?
Ans:
No not possible for SQL Server 2005. To rollback a SP you have to uninstall entire product and reinstall it.
For Sql Server 2008 you can uninstall a SP from Add/Remove programs.
Some people are saying that we can do it by backup and replace the resource db. But I am not sure about that.
Q. What is a deadlock and what is a live lock? How will you go about resolving deadlocks?
Ans:
Deadlock is a situation when two processes, each having a lock on one piece of data, attempt to acquire a lock on
the others piece. Each process would wait indefinitely for the other to release the lock, unless one of the user
processes is terminated. SQL Server detects deadlocks and terminates one users process.
A livelock is one, where a request for an exclusive lock is repeatedly denied because a series of overlapping shared
locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A
livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait
indefinitely.
Q. SQL Server is not responding. What is action plan?
Ans:
Connect using DAC via CMD or SSMS
Connect via CMD
SQLCMD -A U myadminlogin P mypassword -SMyServer dmaster
Once you connect to the master database run the diagnostic quires to find the problem
Correct the issue and restart the server
Lite Speed 5.0 Quest Soft Backup and Restore
Benefits using Third Party Tools:
Encapsulate a complete database restore into a single file to speed up restore time
When we need to improve upon the functionality that SQL Server offers natively
So
According to the 2005 Survey of Wintercorp, The largest SQL Server DW database is the 19.5 terabytes. It
is a database of a European Bank
High Security. It is offering high level of security.
Speed and Concurrency, SQL Server 2005 system is able to handles 5,000 transactions per
second and 100,000 queries a day and can scale up to 8 million new rows of data per day,
Finally more technical peoples are available for SQL SERVER when we compare to any other database.
that we can say SQL SERVER is more than enough for any type of application.
2000: Owner = Schema, hard to remove old users at times Schema is separate.
2005: Better granularity in easily controlling security. Logins can be authenticated by certificates.
Encryption
2000: No options built in, expensive third party options with proprietary skills required to implement
properly.
2000: Clustering or Log Shipping requires Enterprise Edition and Expensive hardware.
2005: Clustering, Database Mirroring or Log Shipping available in Standard Edition. Database Mirroring can
use cheap hardware.
Scalability
2005: 4 CPU, no RAM limit in Standard Edition. More 64-bit options offer chances for consolidation.
Q. What are the Hotfixes and Patches?
Ans:
Hotfixs are software patches that were applied to live i.e. still running systems. A hotfixis a single, cumulative
package that includes one or more files that are used to address a problem in a software product (i.e. a software
bug).
In a Microsoft SQL SERVER context, hotfixes are small patches designed to address specific issues, most commonly
to freshly-discovered security holes.
Ex: If a select query returning duplicate rows with aggregations the result may be wrong.
Q. Why Shrink file/ Shrink DB/ Auto Shrink is really bad?
Ans:
In the SHRINKFILE command, SQL Server isnt especially careful about where it puts the pages being moved from
the end of the file to open pages towards the beginning of the file.
The data becomes fragmented, potentially up to 100% fragmentation, this is a performance killer for your
database;
The operation is slow all pointers to / from the page / rows being moved have to be fixed up, and the
SHRINKFILE operation is single-threaded, so it can be really slow (the single-threaded nature of SHRINKFILE is
not going to change any time soon)
Recommendations:
Shrink the file by using Truncate Only: First it removes the inactive part of the log and then perform
shrink operation
Rebuild / Reorganize the indexes once the shrink is done so the Fragmentation level is decreased
Q. Which key provides the strongest encryption?
Ans:
AES (256 bit)
The longer the key, the better the encryption, so choose longer keys for more encryption. However there is a
larger performance penalty for longer keys. DES is a relatively old and weaker algorithm than AES.
AES: Advanced Encryption Standard
DES: Data Encryption Standard
Q. What is the difference between memory and disk storage?
Ans:
Memory and disk storage both refer to internal storage space in a computer. The term memory usually means
RAM (Random Access Memory). The terms disk space and storage usually refer to hard drive storage.
Q. What port do you need to open on your server firewall to enable named pipes connections?
Ans:
Port 445. Named pipes communicate across TCP port 445.
Q. What are the different log files and how to access it?
Ans:
SQL Server Error Log: The Error Log, the most important log file, is used to troubleshoot system
problems. SQL Server retains backups of the previous six logs, naming each archived log file sequentially. The
current error log file is named ERRORLOG. To view the error log, which is located in the %Program-Files
%\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG directory, open SSMS, expand a server node, expand
Management, and click SQL Server Logs
SQL Server Agent Log: SQL Servers job scheduling subsystem, SQL Server Agent, maintains a set of log
files with warning and error messages about the jobs it has run, written to the %ProgramFiles%\Microsoft SQL
Server\MSSQL.1\MSSQL\LOG directory. SQL Server will maintain up to nine SQL Server Agent error log files. The
current log file is named SQLAGENT.OUT, whereas archived files are numbered sequentially. You can view SQL
Server Agent logs by using SQL Server Management Studio (SSMS). Expand a server node, expand Management,
click SQL Server Logs, and select the check box for SQL Server Agent.
Windows Event Log: An important source of information for troubleshooting SQL Server errors, the
Windows Event log contains three useful logs. The application log records events in SQL Server and SQL Server
Agent and can be used by SQL Server Integration Services (SSIS) packages. The security log records
authentication information, and the system log records service startup and shutdown information. To view the
Windows Event log, go to Administrative Tools, Event Viewer.
SQL Server Setup Log: You might already be familiar with the SQL Server Setup log, which is located at
%ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Summary.txt. If the summary.txt log file shows a
component failure, you can investigate the root cause by looking at the components log, which youll find in
the %Program-Files%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files directory.
SQL Server Profiler Log: SQL Server Profiler, the primary application-tracing tool in SQL Server, captures
the systems current database activity and writes it to a file for later analysis. You can find the Profiler logs in
the log .trc file in the %ProgramFiles%\Microsoft SQL Server\MSSQL.1\MSSQL\LOG directory.
Q. Explain XP_READERRORLOG or SP_READERRORLOG
Ans:
Xp_readerrorlog or sp_readerrorlog has 7 parameters.
Xp_readerrorlog <Log_FileNo>,<Log_Type>,<Keyword-1>,<Keyword-2>,<Date1>,<Date2>,<Asc/Desc>
Log_FileNo: -1: All logs
0: Current log file
Q. Lets say a user is performing a transaction on a clustered server and failover has occurred. What will
happen to the Transaction?
Ans:
If it is active/passive, there is a good chance the transaction died, but active/passive is considered by some the
better as it is not as difficult to administer. I believe that is what we have on active. Still, active/active may be
best depending on what the requirements are for the system.
Q. How you do which node is active and which is passive. What are the criteria for deciding the active node?
Ans:
Open Cluster Administrator, check the SQL Server group where you can see current owner. So current owner is the
active node and other nodes are passive.
Q. What is the common trace flags used with SQL Server?
Ans:
Deadlock Information: 1204, 1205, 1222
Network Database files: 1807
Log Record for Connections: 4013
Skip Startup Stored Procedures: 4022
Disable Locking Hints: 8755
Forces uniform extent allocations instead of mixed page allocations 1118 (SQL 2005 and 2008) To reduces TempDB
contention.
Q. What is a Trace flag? Types of Trace Flags? How to enable/disable it? How to monitor a trace flag?
Ans:
http://blogs.technet.com/b/lobapps/archive/2012/08/28/how-do-i-work-with-trace-flags.aspx
Q. What are the limitations for RAM and CPU for SQL SERVER 2008 R2?
Ans:
Feature
Standard
Enterprise
Datacenter
Max Memory
64 GB
2TB
4
Sockets
8 Sockets
mssqlsystemresource.mdf and
mssqlsystemresource.ldf
Q. Can you elaborate the requirements specifications for SQL Server 2008?
Ans: