Thursday 16 March 2017

SQL Server interview question Part 7

1. Ques: What is BCP utility in SQL SERVER ?
Answer:
BCP (Bulk Copy Program) is a command line utility by which you can import and export large amounts of data in and out of SQL SERVER database.
 With BCP, you can import and export large amounts of data in and out of SQL Server databases quickly and easily.

We can run a bcp command (along with the appropriate arguments) at a Command Prompt window. The command should conform to the following syntax:

bcp {table|view|"query"}
    {out|queryout|in|format}
    {data_file|nul}
    {[optional_argument]...}

As you can see, a bcp command requires three arguments. The first (table|view|“query”) represents the data source or destination in a SQL Server database. You can use the bcp utility to export data from a table or view or through a query. If you specify a query, you must enclose it in quotation marks. In addition, you can import data into a table or view. If you import into a view, all columns within the view must reference a single table.

out: The command exports data from a table or view into a data file.
queryout: The command exports data retrieved through a query into a data file.
in: The command imports data from a data file into a table or view.
format: The command creates a format file based on a table or view.


2. Ques: What is SQL Server log shipping? what are the Advantages and disadvantages of log shipping ?
Answer:
log shipping is a technique which involves two or more SQL Server instances and copying of a transaction log file from one SQL Server instance to another. The process of transferring the transaction log files and restoring is automated across the SQL Servers. As the process result there are two copies of the data on two separate locations

A log shipping session involves the following steps:

Backing up the transaction log file on the primary SQL Server instance
Copying the transaction log backup file across the network to one or more secondary SQL Server instances
Restoring the transaction log backup file on the secondary SQL Server instances


Advantages and disadvantages of using SQL Server log shipping

SQL Server log shipping is primarily used as a disaster recovery solution. Using SQL Server log shipping has multiple benefits: it’s reliable and tested in details, it’s relatively easy to set up and maintain, there is a possibility for failover between SQL Servers, data can be copied on more than one location etc.

Log shipping can be combined with other disaster recovery options such as AlwaysOn Availability Groups, database mirroring, and database replication. Also, SQL Server log shipping has low cost in human and server resources

The main disadvantages in the SQL Server log shipping technique are: need to manage all the databases separately, there isn’t possibility for an automatic failover, and secondary database isn’t fully readable while the restore process is running

No comments:

Post a Comment

Thank you for comment