If I try to backup of database in sql 2012 with t-Sql as follows:
Backup database db1
to disk='c:myfullbkup.bak' with init
go
This code works absolutely fine.
But if I try to take backup through SSMS -Task -Backup in object explorer and gave the same path of c: drive or any other folder outside sql default "Backup" folder.It gives error as access denied.This was not the scene in Sql server 2008.
I would like to have a script , that sends a mail to the dba mail box when the database backup fails . The mail should be sent to the SMTP server.
I have the script which gives the whole output of the backup status but I would like it to change so that it fires only when a backup fails. Please suggest me what to do..
select bmf.physical_device_name, RIGHT(bmf.physical_device_name, CHARINDEX('', REVERSE(bmf.physical_device_name))-1) as physical_device_file, bs.database_name, bs.backup_start_date, bs.backup_finish_date, bs.type, bs.first_lsn, bs.last_lsn, bs.checkpoint_lsn, bs.database_backup_lsn into #backup from msdb.dbo.backupset bs, msdb.dbo.backupmediafamily bmf where bmf.media_set_id = bs.media_set_id and bs.backup_finish_date is not null AND bs.type = 'D' AND bs.backup_start_date = (select max(backup_start_date) from msdb.dbo.backupset WHERE type = bs.type and database_name = bs.database_name) order by bs.database_name, bs.backup_start_date asc
DECLARE GetBackup CURSOR FOR select database_name, backup_finish_date from #backup order by database_name
OPEN GetBackup FETCH NEXT FROM GetBackup INTO @dbname, @Status
WHILE @@FETCH_STATUS = 0 BEGIN select @message = @message + @dbname + ' backup up on ' + @Status + Char(13) FETCH NEXT FROM GetBackup INTO @dbname, @Status END Close GetBackup Deallocate GetBackup
Hi everyone, I am running SQL 2000 SP3. I have one maintenence plan that is backing up one database and that is working fine. I am trying to create another maintenence plan for another database but the job does not execute and it gives me errors. Both SQL server and the agent uses 'local system account' to run the service. I have tried changing this to a domain account to see if it fixes anything. Also on the jobs, the job owner is a domain account. Below are two erros I am getting when running the jobs. Error1: BackupDiskFile::CreateMedia: Backup device 'D:SQL Backups....mybackupfile.bak' failed to create. Operating system error = 3(The system cannot find the path specified.).
Error2: BACKUP failed to complete the command BACKUP DATABASE [Database_Name] TO DISK = N'D:SQL Backups....mybackupfile.bak' WITH INIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
I have a maintenance plan step to perform transaction log backups. There are a few databases that are offline. The backup seems to fail because it tries to backup the offline databases. The backup step is by itself as one of three subplans, although it also fails when it is the only step in a plan with only one subplan.
I have another server that is only on SP1 and it does not have problems handling the offline databases.
The database is SQL Server 2000. Recover Plan = 'Simple'. Maintenance Plan always fails when DBCC tries to put database in single-user mode so it can do the backup, if there is a user has a connection to it from EssBase. No queries running - just a connection. How can I get SQL Server to automatically kill the connections so it can do the backup?
I have a database project where objects have been pulled in from the database using schema compare.
Unfortunately CDC tables which are referenced in stored procedures on the database have not been pulled in by the schema compare & hence I cannot build the project and deploy changes back to the database.
I am using the Simple recovery model and I'm taking a weekly full backup each Monday morning with differentials taken every 4 hours during the day.
On Wednesday afternoon, a programmer ran a process that corrupted the db and I had to restore to the most recent differential. It was 5pm in the afternoon and a differential backup had just occured at 4pm. No problem, I figured.
I restored the full backup from Monday morning and tried to restore the most recent differential backup. The differential restore failed. Since I had used T-SQL for the initial attempt, I tried using Enterprise Manager to try again.
When viewing the backup history, I see my initial full backup taken on Monday plus all the differentials. BUT, on closer inspection, I noticed another full backup in the backup history that was taken early Tuesday morning. I can't figure out where this Tuesday morning full backup came from. It wasn't taken by me (or scheduled by me) and I'm the only one with access to the server. My full backups are usually named something like HCMPRP_20070718_FULL.bak. This erroneous full backup was named something like HCMPRP_03a_361adk2k_dd53.bak. It seemed like it was a system generated name. Not something I would choose. To top it off, I could not find this backup file anywhere on the server and when I tried to restore using this full backup, it failed.
Does anyone have any clues as to where this full backup might come from? Does SQL Server trigger a full backup on its own if some threshold is reached?
I ended up having to restore using the differential taken just before this erroneous full backup and lost a day of transactions.
I'm working on a project where I need to build a small database and then copy it to a server at the client's site. I can't connect directly, so I have to use a VPN connection and use Remote Desktop, copy the database backup from my machine to the cloud, then download it to the client machine. The project is still in the early stages, and the client is still sending me data in CSV files and Excel spreadsheets. I'm periodically needing to do a complete refresh of the database at the client. I've hacked my way through it a couple of times, but I need to know the proper way to do it. I get errors on the restore step, telling me the file is in use.
finding the database size from the backup file.I have SQL 2012 backup file, is there any way to find the estimated database size from the backup.I tried restoring , i got an error saying " no space need additional xxx bytes " ...does this error gives the exact space needed to restore ?
One more question....one of the backup file size is 7.2 GB, when i try to restore it ....it throws error saying it needs 292GB extra space while only 100 Gb is available. How come 392 Gb sized database becomes 7.2 Gb .bak file ?
I am having issues with Restoring the Backup of same Database on to the same server , as i know like many of you will be asking y i need to restore on same server.. Well the need came in that way , now i think i know the problem (i.e) The Orginla DB is there and also i am restoring the same DB again on that server, so .mdf and .ldf will be same .
I'm using SQL Server 2012 R2 and am working on configuring vendor access to a particular DB. I have a test db & (what will eventually be) the production DB. I've configured security for the test DB and want to back that up, then restore it (including all settings) to the prod one, renaming it to the prod DB name.
I need to create a new db from a backup file of an allready existing database (vehicledb) on this server.So i created a new database with name "vehicledb2" .But when i try this, the backup says that this file is used...The backup set holds a backup of a database other than the existing 'Vehicles2' database. Restore of database 'Vehicledb' failed.
I have accidentally taken the backup of a database twice into same .bak file. Now the file is twice the size. Will it be fine if I restore this backup? Or will I screw up any data?
We have a bunch of SQL 2012 databases which use SQl Server authentication (essentially local dev instances). Is it possible to take a backup of one of these database and then push them onto a (central) server which uses Integrated security (based on active directory authentication) using a script to change and map the authentication model in the process?
I am attempting to create a Test db from a full backup of the production db. With 2012, I cannot do it the the way i had done it in previous versions (and now i understand why because of Logical names).
The Test db runs in the same instance as Prod db.
I attempted to run this but come up with errors. This is what i executed:
RESTORE DATABASE TEST FROM DISK = 'E:<path>FULL.BAK' WITH REPLACE, RECOVERY, MOVE 'PROD' TO 'E:<path>TEST.MDF';
The errors are all cannot execute due to PROD is in use.
I need only the count of databases that last fullbackup was older then 24 hours or null. and status is online. I have tried
SELECT Count(DISTINCT msdb.dbo.backupset.database_name) From msdb.dbo.backupset where datediff(day,backup_finish_date,GETDATE()) > 1 -- or is null and Database_Name not in ('tempdb','ReportServerTempDB','AdventureWorksDW','AdventureWorks') --online also group by Database_name, backup_finish_date
Tried using where max(backup_finish_date) < datediff(day,backup_finish_date,GETDATE()) .But get the aggregate in where clause error. get a count of databases with backups older than 24 hours not including the samples, report service, and tempdb. I would also want to put status is online but havent gotten the above to work so havent tried to add that yet.
We are getting a security audit for the company I work for and got this question recently, and while my answer would be "everything is possible", I know that DIFFs alone can't restore a SQL database.
Having said that (and don't want to read hypothetical comments) how can a hacker read confidential information from an unencrypted DIFF backup? Let's say he steals the DIFF backup alone.
I have a problem when i restore my .DAT_BAK file. I am getting error like "The backup set holds a backup of a database other than existing database. Restore Database is terminating abnormally".
I tried by using
RESTORE DATABASE <DATABASENAME> FROM DISK = 'D:DATAMYTEST.DAT_BAK' WITH MOVE 'VZAI_DATA' TO D:PROGRAM FILES..MSSQLTEST.MDF', MOVE 'VZAI_LOG' TO D:PROGRAM FILES..MSSQLTEST.LDF', REPLACE
And also i tried like
RESTORE DATABASE <DATABASENAME> FROM DISK = 'D:DATAMYTEST.DAT_BAK'
WITH REPLACE
When i use like this,
RESTORE FILELISTONLY FROM DISK = 'D:DATAMYTEST.DAT_BAK'. I am able to get the output as LogicalName, PhysicalName, Type, FileGroupName, Size, etc.
On the SQL Server the Event Viewer shows the same messages and errors every evening between 22:05:00 and 22:08:00. The following information messages are shown for every database:
"I/O is frozen on database <database name>. No user action is required. However, if I/O is not resumed promptly, you could cancel the backup."
"I/O was resumed on database <database name>. No user action is required."
"Database backed up. Database: <database name>, creation date(time): 2003/04/08(09:13:36), pages dumped: 306, first LSN: 44:148:37, last LSN: 44:165:1, number of dump devices: 1, device information: (FILE=1, TYPE=VIRTUAL_DEVICE: {'{A79410F7-4AC5-47CE-9E9B-F91660F1072B}4'}). This is an informational message only. No user action is required."
After the 3 messages the following error message is shown for every database:
"BACKUP failed to complete the command BACKUP LOG <database name>. Check the backup application log for detailed messages."
I have added a Maintenance Plan but these jobs run after 02:00:00 at night.
Where can I find the command or setup which will backup all databases and log files at 22:00:00 in the evening?
Using Ola Hallengren's scripts I do a full backup of a database on a Sunday. Then differential backups every 6 hours and log backups every hour. I would like to keep a full week of backups based off the full backup done on Sunday. Is there a way for me to clear out the diff and log folders after the successful full backup on Sunday nights?
I'm looking to schedule a maintenance plan for my databases which I have done.I'd like this database to be copied to another folder and the name altered to include the file name and the current date time stamp.Is this possible in the scheduled maintenance plan?
I'm getting this message on my third automated backup of the transaction logs of the day. Both databases are in full recovery mode, both successfully backed up at 01.00. The transaction logs backed up perfectly happily at 01:30 and 05:30, but failed at 09:30.
The only difference between 05:30 and 09:30's backups is that the log files were shrunk at 08:15 (the databases in question are the ones that sit under ILM2007, and keeping the log files small keeps the system running better).
Is it possible that shrinking the log files causes the database to think that there hasn't been a full database backup?
Guys I was wondering if you can help me figure out the problem with the script.
1) I am getting the following error message on one of the job which is backing up all the databases on the server.
...ges for database 'AdminWorkFlow_Reports', file 'AdminWorkFlow_Reports_Data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 1 pages for database 'AdminWorkFlow_Reports', file 'AdminWorkFlow_Reports_Log' on file 1. [SQLSTATE 01000] (Message 4035) Backup or restore operation successfully processed 433177 pages in 64.328 seconds (55.163 MB/sec). [SQLSTATE 01000] (Message 3014) Processed 113720 pages for database 'BMSRep', file 'BMS_Data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 1 pages for database 'BMSRep', file ' BMS_Log' on file 1. [SQLSTATE 01000] (Message 4035) Backup or restore operation successfully processed 113721 pages in 17.200 seconds (54.162 MB/sec). [SQLSTATE 01000] (Message 3014) Processed 208 pages for database 'EmailAddress', file 'EMailAddress_STGE_Data' on file 1. [SQLSTATE 01000] (Message 4035) Processed 1 pages for database 'EmailAddress', file 'EMailAddress_STGE_Log' on file 1. [SQLSTATE 01000] (Message 4035) Backup or restore operation succe... The step failed.
Not sure where to start. I looked up the backup script it looks fine.
BackUp Database AdminWorkFlow_Reports to Disk = 'q:\AdminWorkFlow_Reports12-17-2007.bak'
-- -- -- --
BackUp Database EmailAddress to Disk = 'q:\EmailAddress12-17-2007.bak'
2)Also I have another script which for some reason doesn't run on some nights. Its enabled and the job is scheduled daily but its not running for about a week.
DECLARE DB_Cursor CURSOR FOR SELECT NAME FROM sysdatabases
OPEN DB_Cursor
FETCH NEXT FROM DB_Cursor INTO @DB_Name
WHILE @@FETCH_STATUS = 0 BEGIN IF @DB_Name <> 'tempdb' AND @DB_Name <> 'model' BEGIN print '--------------------------------<< ' + @db_name + ' >>--------------------------------' SET @Backup_Path = N'd:sql2005backupsightly' + @DB_Name + 'Daily' + '.bak' SET @Backup_Name = @DB_Name + N' backup' BACKUP DATABASE @DB_Name TO DISK = @Backup_Path WITH INIT print '' END FETCH NEXT FROM DB_Cursor INTO @DB_Name END
I have a trans log backup that runs every 15 minutes on san, works fine until I do a backup after a large load. I get the below error message. Anyone had this before?
Executed as user: DPSCSDOMsqlexec. The file on device 'n:sqllogsmdentallgdmp' is not a valid Microsoft Tape Format backup set. [SQLSTATE 42000] (Error 3242) BACKUP LOG is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step fail
My transaction log backup is failing with the following error: Does anyone know how I can fix it? (null) Microsoft (R) SQLMaint Utility (Unicode), Version 8.00.194 Copyright (C) Microsoft Corporation (null) Logged on to SQL Server as 'NT AUTHORITYSYSTEM' (trusted) Starting maintenance plan 'Maint Plan - TLogs' on 5/7/2001 8:18:11 AM Backup can not be performed on database. This sub task is ignored. (null) Thanks
I am trying to backup a database to a tape. It works when it wants to. I get a 3013 error. The drive is fully functional. Seagate backup works fine. SQL Backup does not. I think it might be that the tape needs retensioning sometimes. Here is the sql statement: BACKUP DATABASE pubs TO TAPE='.ape0' WITH FORMAT. Is there a retension parameter I am failing to see?
Our Transaction Log backup job runs every two hours from 7:00am to 8:59pm. Today, our Full backup job and the first Transaction Lob backup job ran successfully. Subsequent Transaction Log Backups have failed with the following error message under Job History:
"The job failed. The Job was invoked by Schedule 13 (Schedule 1). The last step to run was step 1 (Step 1)."
The caveats are that the database is in Full recovery mode and a .TRN file is generated on the server. Also, the SQL Server log says the job ran successfully. Any ideas?
HelloI'm seeing the backup using SMO fails with big databases (>15GB). Ihave a 2GB database and I can see the command go thru. in Profiler butafter it's about 50-70% done, I get an exception saying backup failed.There is no details on the SQLServer log.Here's the code snippet:bk.Initialize = m_backupInit;bk.PercentCompleteNotification = 10;bk.PercentComplete += newPercentCompleteEventHandler(bk_PercentComplete);bk.SqlBackup(m_Server);Here's the command as captured by SQL-Profiler:BACKUP DATABASE [Test_MODEL] TO DISK = N'D:TempTest_Model_Backup.dat' WITH NOFORMAT, INIT, NOSKIP, REWIND,NOUNLOAD, STATS = 10Has anyone else seen this. The wierd thing is it works using old SQL-DMO.thanksSunit