To restore a Database from a bak file


In order to restore a database that was backed up from an existing server or a remote server, the following sql command can be used

 

RESTORE DATABASE [MyDb] FROM DISK=’C:\Program Files\Microsoft SQL Server\MSSQL11.LOCAL\MSSQL\Backup\MyDb.bak’
WITH MOVE ‘MyDb’ TO ‘C:\Program Files\Microsoft SQL Server\MSSQL11.LOCAL\MSSQL\DATA\MyDbdata.mdf’, MOVE ‘CelloV45_log’ TO ‘C:\Program Files\Microsoft SQL Server\MSSQL11.LOCAL\MSSQL\DATA\MyDblog.ldf’

Advertisements

Enabling the SQL Server to be accessed across machines or from remote machine


Following steps are to be followed so that the SQL Server can be accessed across machines or be accessed from a remote machine via Sql Server Management Studio [SSMS]

Enable the following
1) TCP/IP,
2) Shared Memory
3) Named Pipes

from all prorams> sql 2012 > configuration tools > sql server configuration manager > expand sql server network configuration > protocols for sql2012r2de

Now, in the “Run” command, put Services.msc and then choose the SQL Server and then enable the SQL Server Browser service

Now try connecting from any remote machine.

Trackback: http://stackoverflow.com/questions/5956926/unable-to-connect-to-a-sql-server-database-remotely