I am trying to restore a SQL database using .bak file on an Ubuntu server where SQL Developers is installed.
I used the following command line:
sqlcmd -S localhost,1433 -U SA -Q "RESTORE VERIFYONLY JCIHistorianDB
FROM DISK = '/home/test_db.bak' WITH MOVE 'testDB_Data' TO
'/var/opt/mssql/data/test_db.mdf', MOVE 'testDB_Log' TO
'/var/opt/mssql/data/test_db.ldf'"
As per following, the result is successful:
RESTORE DATABASE successfully processed 528668 pages in 845.191 seconds
However the database data is around half of the size it should be. It's not coming from the .bak file as the restoration from the same file on a windows instance was all good.
Do you have any ideas why this happened? I also have enough space on the Ubuntu Server.
Thank you very much for your time.
Related
I am using SQL Server Express and I have a stored procedure for taking backups which I took from Microsoft: How to schedule and automate backups of SQL Server
Then I use Windows Task Scheduler for taking the backups.
I have a task running on 2 AM which takes a full backup using command:
sqlcmd -S SERVER\MSSQLEXPRESS -E -Q "EXEC sp_BackupDatabases #backupLocation='C:\Backups\SQL\TEMP\', #backupType='F'"
Then from 2.30 AM I take a differential backup every hour using command:
sqlcmd -S SERVER\MSSQLEXPRESS -E -Q "EXEC sp_BackupDatabases #backupLocation='C:\Backups\SQL\TEMP\', #backupType='D'"
Now here I have a problem, the full backup works but after that I see no new added backup files in my folder. When I open the server I see a command prompt from the differential backup running asking to overwrite the FULL backup files.
I click A from ALL and then it works. The hour after again, a command prompt to overwrite previous DIFF and FULL backup files.
How can I set this to always be ALL or how can I disable this?
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.
My Windows Server 2003 got corrupted and I'm trying to repair it but before that I'm trying to create a backup of my SQL Server databases.
Can anyone please tell me which files do I need to copy from the Windows command line as I'm not familiar with SQL Server. Database files from which I can restore data.
Its an old server but data is important.
And also if I repair Windows server 2003 using repair disk will it effect on SQL Server files ?
http://postimg.org/image/5jsstbqmd/
When I start server I get this error.
You can use this SQL command (adapt to your specific case):
--Back up the files in SalesGroup1:
BACKUP DATABASE YourDBName
TO DISK = 'Z:\SQLServerBackups\BackupFileName.bck';
GO
See Backup in Transact-SQL for more details.
To run a SQL script from command line:
sqlcmd -S myServer\instanceName -i C:\myScript.sql
Before messing with anything, you could take a complete image of your hard drive using a tool such as clonezilla.
I would get to the root of your disk and run
dir /a /s *.mdf
The .mdf file is the file extension that SQL Server uses, and that command will tell you where they are located. The log files are usually in the same directory.
As per your second question, the disk repair will only affect your database files if they are part of the corruption that is happening; which is quite likely if you were running a high I/O database when it crashed. I would definitely try and copy those files off before running a disk check.
On the surface, i know this file is huge and it sounds like i'm out of hdd space. I have over 193gb available. Now here's my question. I have a .sql file that's 65gb in size. I generated it by right clicking the database and generating scripts. I included the schema and data as well.
I want to run this script so I can have a good copy of the database on my local sql server. I try to open the file in sql server management studio 2012 and i get the following error.
I cant backup the database and restore it (the preferred method) so I googled this error but I got results about everything but my issue. What do i need to change in order to open and run this ginormous file. Thanks
I doubt that sqlcmd will give you any better results, but here is a reference page sqlcmd
here is a sample:
sqlcmd -S myServer\instanceName -i C:\myScript.sql
i create backup from localhost MYSQL database(drupal) using PHPMyAdmin (file format *.sql). size of this backup = 20MG. i create new database in PHPMyAdmin my live(online) server. Now, when i import backup sql Files i see this error :
#2006 - MySQL server has gone away
i know this error fix with this:
edit ../sql/bin/my.ini
set max_allowed_packet to e.g. 16M
but my server support said: better way is restore mysql using:
mysql -u username -p dbname < file.sql
now, i don't know how to work with this command line for remote server?!
You need SSH access to your server to execute that command using a terminal. If support told you you should use that command, I would think you have SSH access. The SQL file would have to be on your server, so you'd need to transfer it there first (using for example scp).
But if you're not used to the command line, I would recommend first spending some time learning the basics before jumping right into it ;)