thrown into a dba role. I have two servers, neither one is connected to a network. How would I get a db from one of them to the other? Would I need to do a select all and export and then import into the other after I created a new db that matches the other?
Thanks.
Since there is no connectivity between them, you got only way to use external storage drive to transfer the database. In your case to move/copy complete database you can use anyone of following options:
Before proceeding consider the SQL Server version (you can identify executing select ##version) because the database or it's backups cannot be restored into lower version i.e. if you taking backup form SQL 2012 it can be only restored on SQL 2012 or higher
Hope you got SSMS installed and ready in both servers which is essential to do management activities:
Backup and restore - Summarized steps
Login to Source SQL Server locally, connect external storage drive
Perform backup and store the backups in external storage
Remove external storage drive from Source server and connect it to Destination Server
Login to Destination SQL Server locally, perform restore from backup file (that stored in external drive)
Copy MDF and LDF files - Summarized steps
Login to Source SQL Server locally, connect external storage drive
Set target database to offline. Copy .MDF, .NDF (if exists) and .LDF files into external storage drive
Remove external storage drive from Source server and connect it to Destination Server
Login to Destination SQL Server locally, copy the files form external storage and paste into same directory as source server.
Perform Attach database
Related
I have a SQL Server named TheOtherSide. It is in a different domain (OtherDomain).
I have another SQL Server named MySide in my own domain (MyDomain).
There is a VPN connection between the two servers that allows only TCP over port 1433.
I want to take a backup of the database CoolDatabase that exists on TheOtherSide and restore that backup on server MySide.
That process needs to be automated.
Any backup script I see stores the backup in OtherDomain where I cannot retrieve it.
Can I run a PowerShell script to create the backup that will store the backup in MyDomain?
A classic backup (.bak) cannot be streamed out of the SQL Server machine installation.
You can save the backup on a shared disk or another folder and get it with FTP or something like that.
If your objective is only to backup/restore (and NOT a backup plan, like full backup, incremental backup, and log backup) you can backup/restore the database has .bacpac, in this case, you can use scripts like dbatools PowerShell Module
I have set up 2 separate Database Engine connections in SSMS 2017. One connection is to the company server databases and the other is for my local database instance. Now, when I open SQL files with code referring to the Server Instance (#1), it fails to run because it doesn't recognize the tables or the attributes. I have to right click on the Server Name in the Object Explorer and open A New Query page, copy the code from the SQL file and paste it onto the new Query page and then run it.
How do I get the SQL file to run by opening it and clicking on Execute?
If you are trying to reach a different database instance from your local hosted instance, you will need to create a linked server.
Once you have that in place you can mix the database connections from a single sql file by using 4 part naming conventions [Server].[Database].[Schema].[Table].
I have two server. Server A is the application server, and server B is the database server. Normally I use SQL Management Studio in Server A to query. I intend to do a database backup (.bak), but whenever I do this through SQLMS, the file is created at server B. I dont have access to do a remote connection to server B.
How do I get the backup file?
You can specify a UNC path for the target of the backup. Keep in mind, however, that the account that the SQL Server service runs under will need network access to that path. This is one good reason why the SQL installer asks you which account to run the services under.
I ended up using generation script. But instead run all in a single script, I run 3 different script (create table, create stored procedure, and data) at a time. I do this because if I run in a single script, I ended up an error. By the way, the script can be compressed (zip) to give a smaller file size.
I am in the process of moving all our SharePoint DB's from a SQL 2005 server to a new 2008 server, and after moving the config database, everything seems ok, except when I click on "Timer Job Status" (under Central Admin > Operations > Global Configuration) I receive a "Unable to connect to database. Check database connection information and make sure the database server is running." error.
I get the following entries in the log regarding this:
12/03/2010
13:51:41.80
w3wp.exe
(0x09E0)
0x09AC
Windows SharePoint Services
General
8e2r
Medium
Possible mismatch
between the reported error with code =
0x8107053b and message: "Unable to
connect to database. Check database
connection information and make sure
the database server is running." and
the returned error with code
0x81020024.
12/03/2010
13:51:45.61
OWSTIMER.EXE
(0x0744)
0x0DD8
Windows SharePoint Services
Database
6f8e
Critical
SQL Database
'SP_Test_Config' on SQL Server
instance 'test-server' not found.
Additional error information from SQL
Server is included below. Cannot open
database "SP_Test_Config" requested by
the login. The login failed.
It should be noted that in order to ensure that it was no longer using the config database on the old server, I detached the original SP_Test_Config database in SQL Management Studio.
Obviously there are still references to the old SP_Test_Config database on the old 2005 server. How do I remove these references? Or, barring that, how do I move the config database in such a way that no references to the old 2005 server will remain?
Thank you in advance!
Not really an answer, but what we ended up doing (basically start from scratch using SQL Aliases):
First, create the SQL Server alias. This will make it so if you need to move the databases again in the future, you can just migrate all the databases to the new SQL Server, and change your SQL Server alias to point at that server. This should save you a lot of trouble and heartache in the future.
Run SQL Server Client Configuration Utility at: C:\Windows\System 32\cliconfig.exe.
Under the Alias tab, create a SQL Server Alias for the new SQL Server.
Now, recreate the farm.
Run stsadm -o preparetomove on all content DB's Backup all content DB's and copy to new SQL server
Remove all servers from farm using SharePoint Configuration Wizard
Recreate farm using SharePoint Configuration Wizard with the alias of the SQL Server you created above
Recreate all web apps with temp content DB's
Run stsadm -o deletecontentdb on all temp content databases created in step 4
Run stsadm -o addcontentdb using copied production databases as content database
Troubleshoot ad nauseum
I need to backup my SQL Server 2008 database to another PC on network. I've even mapped network drive and assigned it another driver letter.
But when I try to select .bak file while exporting, only C: shows up. I've even restarted my SSMS.
Can somebody point out what else I may need to do? Thanks!
You can by using SQL
BACKUP DATABASE Foo TO DISK = '\\myserver\myshare\foo.bak' WITH INIT
Make sure the account used for the sql services has enough rights to write to the other pc.
For the reason the mapped network drives don't show up made with your user account. This has to do with the Sql Server service running under another user account then the one you've used for mapping the drive.