Want to backup/restore to copy a dev database from our server to my local machine. Backup is no problem, but restore fails with 'no database specified' error.
Command:
RESTORE DATABASE [Management]
FROM DISK = N'C:\Databases_2021_Jan_14\Databases_2021_Jan_14\management.BAK'
Clearly,I've identified the database as Management. Or, that's what I think it's saying. And, I'm doing the restore from a backup file on my C: drive.
Might somebody have some insight on this? I'd really appreciate it.
Run the following to verify that the backup is valid and readable first of all. Then identify if you do have a database named Management in the backup set
RESTORE VERIFYONLY
FROM DISK = N'C:\Databases_2021_Jan_14\Databases_2021_Jan_14\management.BAK'
RESTORE HEADERONLY
FROM DISK = N'C:\Databases_2021_Jan_14\Databases_2021_Jan_14\management.BAK'
Related
I'm trying to restore a DB from the class. However, when I try to restore the .bak file, it seems like SSMS doesn't recognize it.
I gave full permissions to the folder which contains the .bak file (it is the default backup folder of ms SQL studio).
Steps I've taken to restore the .bak file:
Right click on DB -> Restore DB -> From device (selected the .bak file location) -> To Database (selected the DB destination)
Like here:
C:\Program Files (x86)\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Backup
The DB is not corrupt I checked 2 other DB same result so I have no idea what is the problem
Here images:
I can not see the DB and I have almost the latest version of MS SQL studio so I can not understand what is going on here and why I can not restore DBs
I checked here:
restore database in ssms 2017 selected bak file in device option and showing nothing in Backup sets to restore option and disable Ok button too
and here:
SQL Server Management Studio can't recognize .bak file
https://www.youtube.com/watch?v=U0FpXwQfBaU
It should be easy and simple like the video above but like I said above something is wrong here and I do not know what is it.
Image of my SQL version
Once you (i mean the service account) got full permissions on the folder where the .bak file sitting and file not corrupted you should be able to restore without any issue, but there are times things fail in GUI and work perfectly with command line. not sure the issue might be exists one of the fix of SSMS release notes
However, you probably want to try following:
Verify the backup file - it does the verification of backup file and detects any error/corruption within backup file
RESTORE VERIFYONLY FROM DISK = 'C:\YourbackupLocation\DbName.bak';
Read the header - it returns information of backup file i.e. DB Version, appended backup files, LSN info and database recovery model etc..
RESTORE HEADERONLY FROM DISK = 'C:\YourbackupLocation\DbName.bak';
Get list of file names from backup - This will be helpful if the file location is different from the source server from where the backup was created
RESTORE FILELISTONLY FROM DISK = 'C:\YourbackupLocation\DbName.bak' ;
Restore backup - actual restore via T-SQL
RESTORE Backup DBName FROM DISK = 'C:\YourbackupLocation\DbName.bak' with replace, recovery, stats;
To relocate files
RESTORE Backup DBName FROM DISK = 'C:\YourbackupLocation\DbName.bak'
with replace, recovery, stats
--- Get the logical name from the result of "RESTORE FILELISTONLY" command
move 'DBName' to 'C:\NewLocation\DBName.mdf',
move 'DBName_Log' to 'C:\NewLocation\DBName_log.ldf' ;
I am testing to see if a SQL Server server based program can also work on AWS Cloud Server with 2016 SQL Server on the Amazon server. In order for me to test it, I need to restore 2 databases.
The first one eventually restored fine once i figured it out...restoring the database from my S3 "bucket" BAK file.
So then I tried to restore the 2nd database, using the same restore stored proceudre, and get this message:
[2017-12-28 02:44:22.320] The file 'D:\rdsdbdata\DATA\smsystemdata.mdf' cannot be overwritten. It is being used by database 'amwsys'.
[2017-12-28 02:44:22.320] File 'sm_system_data' cannot be restored to 'D:\rdsdbdata\DATA\smsystemdata.mdf'. Use WITH MOVE to identify a valid location for the file.
I can't find where to use the WITH MOVE because it won't let me restore it interactively through the Management Studio restore menu; instead I have to give it a stored procedure command:
exec msdb.dbo.rds_restore_database
#restore_db_name='sample99',
#s3_arn_to_restore_from='arn:aws:s3:::lighthouse-chicago/sample999.bak';
And each time it tells me it can't restore it because it's going to overwrite the first database's files.
Much thanks
bill
I think you are stuck in RDS's restriction.
I had the similar problem as you. Multiple restore from one DB instance is impossible at RDS.
Here is RDS's restriction you may encounter.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html
You can't restore a backup file to the same DB instance that was used
to create the backup file. Instead, restore the backup file to a new
DB instance. Renaming the database is not a workaround for this
limitation.
You can't restore the same backup file to a DB instance multiple
times. That is, you can't restore a backup file to a DB instance that
already contains the database that you are restoring. Renaming the
database is not a workaround for this limitation.
If you are in this case, you can't use .BAK file. To avoid it, you should create DB instance with DML and import table data.
How can I restore (or read in a some decent form) a sybase backup that I've been given to be analyzed?
I have been given a backup from sybase database that contains a single .db and one .log file.
I'm new to sybase and I have no access to original system nor I have any information about the database structure that these files contain.
The thing I know is that backup is probably made with command
dbbackup -c "userid=xxx;password=xxx" -d -t -y D:\path\to\backup
I've been asked to analyze the content of the database and to do that I've set up a SAP ASE 16.0 on RedHat 7.
I have tried to restore the backup using the load database command but all I get is a error report:
Backup Server session id is: 17. Use this value when executing the
'sp_volchanged' system stored procedure after fulfilling any volume change
request from the Backup Server.
Backup Server: 4.10.2.1: Label validation error: first label not VOL1.
Backup Server: 6.31.2.4: Volume rejected.
Backup Server: 1.14.2.2: Unrecoverable I/O or volume error. This DUMP or LOAD
session must exit.
Backup Server: 6.32.2.3: /data/sybase/backup/adbname.db: volume not valid
or not requested (server: , session id: 17.)
Backup Server: 1.14.2.4: Unrecoverable I/O or volume error. This DUMP or LOAD
session must exit.
Msg 8009, Level 16, State 1:
Server 'ASE1', Line 1:
Error encountered by Backup Server. Please refer to Backup Server messages for
details.
the error indicates that the database backup file is not valid.
Are you sure that it is a Sybase ASE dump file. ".db" files look like more DB2 backup files than ASE backup files?
First, you didn't write the restore command for restoring dB and I think you used wrong command for getting backup.
Briefly, for getting backup of a Sybase db you have to write:
create backup
go
Backup files are stored in da\server\instance\dasd\backup\unique_backup_id .
And for load it you have to write:
restore backup "unique_backup_id"
go
If restore backup succeeds, the server automatically shuts down; you must manually restart it.
Resources is: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36272.1570/html/commands/X16531.htm
We have a very old sybase server. Our database in it is acting up. We need to restore the backup database file from our backup sybase server. But when I try that, I keep getting this error message:
Msg 7205, Level 17, State 2: Line 1: Can't open a connection to site
'SYB_BACKUP'. See the error log file in the SQL Server boot
directory.
That is how I restore the database backup:
1. Use RCP to copy the dump file from the spare server to the primary server. And name the copy "frombkup_mydb.dump".
2. Drop the old database from the primary server, and re-create an empty one.
3. Then use the following command to load the database from the backup dump file:
load database mydb from "/export/home/syb11.dump/frombkup_mydb.dump"
Unfortunately I don't know where the error log file is. I am not familiar with SCO Unix and Sybase.
Does anyone know why the restore doesn't work?
Please help. Thanks.
Jay Chan
It's likely that your Backup Server is not running.
The SAP/Sybase ASE database process requires the backup server to be running for database backups or restores.
To find which database processes are running you can use the showserver command usually located in:
$SYBASE/$SYBASE_ASE/install/showserver
If the backup server is not running (likely), then in the ./install/ directory, look for the file named RUN_SYB_BACKUP
You can start the server by issuing the command (from the ./install/ directory)
startserver -f RUN_SYB_BACKUP
This should start the backup server, and allow you to restore the database.
To back up my SQL Azure database periodically I have been using the simple tSQL statement
CREATE DATABASE FiveModes10_12_12 AS COPY OF FiveModes
But for this project (analysing some experimental results) my database is a local SQL Server 2012 one and I cannot run that statement (I get the error Incorrect syntax near 'COPY'). Looking at the documentation for the CREATE DATABASE command for SQL Server 2012 there is no AS COPY OF option. What is the simplest alternative?
For long lived copies take e database backup instead:
backup database FiveModes to disk = 'path to .bak file' with init, copy_only;
You can the restore this when needed:
restore database FiveMode from disk = 'path to .bak file';
You can even restore the backup as a new database, but you'll need to move the location of the MDF/LDF files during the restore:
restore database FiveMode_12_12 from disk = 'path to .bak file'
with move 'FiveMode' to '<path to place the new copy of MDF>',
move 'FiveMode_log' to '<path to place the new copy of LDF>'
If you need only short lived copy (eg. create a copy, do some experiment, revert to the copy) you can use database snapshots, but it requires Enterprise license. See Database Snapshots:
create database FiveModes10_12_12 on
(Name = 'FiveMode', FileName = '<path to MDF snapshot file>')
as snapshot of FiveModes;
But be aware that snapshots are not at all like Azure copies, is very detrimental to keep them along for long time. For long time copies use backups.