Hi,
I'm trying to write a restore script. In the past I've always used the SSMS GUI to restore. When running the script below, the process got stuck at around 90%. Eventually I aborted the restore and found out that my C drive was full. The log file of the database I was restoring was 32GB. Can anyone tell me what I'm doing wrong? Thanks.
Code Snippet
ALTER DATABASE [oms] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
RESTORE DATABASE [oms]
FROM DISK = N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupOMS_Blank_Production.bak'
WITH FILE = 1,
REPLACE,
STATS = 10
GO
hello,all I am new to Sql 2000,I installed sql 2000 database in C disk,but Now I found my C disk space is smaller than before,So I want to move my databse(include data and structure) from C Disk to D Disk(its space is very large) . is it possible to do it ? if its can be done ,do I need to change my asp.net program source code (exp: chaneg my crystal report connectstring ) ? thanks in advanced!
We have 2 SQL Server 2k5 servers running the same build - 9.0.2047 . When I backup any database from one server and attempt to restore it to the other, the log file generally increases by 100 fold. It errors out after I try to restore a 100MB db and it tries to create a 9.8GB log file. This happens both when I use the GUI to restore and when I restore from a T-SQL script. What am I doing wrong?
I am trying to create a scheduled task taht will restore a database from a backup file. I do not store my backups on a backup device, but on a local disk. To restore a DB from a backup device, the following statement will work: "Load DBName from BackupDeviceName". Does any know what statement to use to restore from a file, if the file is "E:DBName_db_dump_199909272220".
I am getting occasional failures of a SQL Server 7.0 complete backup to disk on a production database. The errors seem to indicate that another process has the disk file open at the time of the backup. The errors contain the following texts : -
'Cannot open backup device' 'Operating System Error=32 Process cannot access file because it is being used by another process'.
The only other process that should access the disk file is an ARCserveIT scheduled job to copy the disk backup to tape but this is completing long before.
One of the drives that stores the database file is close to running out of space. The chance of me getting more space added to this drive any time soon are really low. What are other options I have?
One of the drives that stores the database file is close to running out of space. The chance of me getting more space added to this drive any time soon are really low. What are other options I have?
Hi all, I have to give support to this new client of ours and the system out there was a real mess.The log files for all four databases were ranging from 5 to 9 GB's, no maintanance no nothing was done since the setup of the system. I have truncated the logs after taking proper backups since it all started after they compalined a DTS was not working, which was due to no disk space available ;). Now I have to shift the log files to a seperate disk. I know it can be done by detaching the database and attaching it back, I was wondering if we can do it without bringing the system offline? Anycomments welcome. Thankyou. regards, harshal.
Due to running out of disk space and reducing I/O contention, I plan to seperate data files and log files to different disk arrays.
My plan is to - detach all databases - copy log files to another disk - attach all databases
The total size of log files is about 60GB. It becomes a problem becasue it spend too much time passing files. To reduce down time, is there any way I can do?
Can I just create new log files and remove the current files by using sql management studio?
I have run perfmon and the avg read queue length is pretty much permanently maxed out at 100%.
I have run a database index defrag.
On further inspection the file system is highly fragmented. There is a file fragmentation of 98% with the mdf file fragmented in 25,000 pieces. Running a standard windows defrag does not resolve this.
Two questions?
1- Is heavy file fragmentation of the MDF file a likely cause of the read queue length bottlneck?
2 - Why is the MDF file not defragmenting? Does the SQL server have to be taken offline? Is it possible to defrag a MDF file?
Our MSSQL 2000 server crashed yesterday and one database cannot be restored. the latest backup we have is june. We can only recover the MDF file from the harddisk and according to our admin, it cannot be restored anymore because no proper shutdown was made.
My Transactional log size increased to 39GB, it is in full recovery mode,
To regain the space, i have done the following BACKUP LOG DB_NAME WITH TRUNCATE_ONLY DBCC SHRINK_FILE (LOG_FILE_NAME,500) But not able to regain the space in the hard disk.
No Transactional backups to truncate the log file were setup.
Can you please tell me why the space was released and what should i do further to clean up the sapce
In SQL Server 2005, via the GUI, I wish to backup a database to an additional disk file (there is already an existing backup disk file for this database), so that I can have more than one backup. I've added the new disk file name, highlighted it, and clicked OK.
I get an immediate error (see below). Note, the 2nd error message is specifying the existing backup disk file, not the new one I'm attempting to create.
"Backup failed for Server 'WCS-DEV-TPA'. (Microsoft.SqlServer.Smo)"
"System.Data.SqlClient.SqlError: The volume on device 'D:Program FilesMicrosoft SQL ServerMSSQLBACKUPWCS_ADV_Longmont.bak' is not part of a multiple family media set. BACKUP WITH FORMAT can be used to form a new media set. (Microsoft.SqlServer.Smo)"
Does anyone know what causes this and how to correct it?
If I return the Average, Minimum, and Maximum values for the counter Physical Disk: Avg. Disk Queue Length, and those values are 10, 0, 87 respectively, which value do I use to compute the Avg. Disk Queue Length for a 4 disk array(RAID 10): Average, Minimum, or Maximum? The disk(lun) is on a SAN.
Hi,I'm new to sql but have a website running it on a hosted site. I want to have a local copy of the site running here for testing. I have everything set on my local machine to run it including MSDE and Enterprise Mgr.I've created a blank db with the same name,username and password on my local machine. From my host I received a dbname.bak file which they said I should just restore to my local machine. This sounded simple but I have no idea how to do this. When I right click on the db file within Ent.Mgr I see the Restore option but I can figure out how to designate the dbname.bak file as the source. I also see an option to import but that isn't any better.Does anyone have some simple directions which will show me the proper steps and where I should be to do this? I'd really appreciate it. I assume it's simple but not having ever done it it has me stumped.Thanks!
I have a .dat file from a SQL Server 6.5 database and am trying to restore it on my server. Any help would be greatly appreciated. If you need more information, please let me know. If it`s not obvious, I`m new to SQL Server so try not to gloss too much over the details.
Tried restoring a database from .bak file through Enterprise Manager and also by usng the following code :
RESTORE DATABASE DBB FROM DISK = 'c:DBA.BAK' WITH REPLACE, RECOVERY, MOVE 'ap0data' TO 'c:mssqldataapm_data.mdf', MOVE 'ap0Log' TO 'c:mssqldataapm_log.ldf'
But, I get an error : Server: Msg 3156, Level 16, State 2, Line 1 The file 'd:mssql7dataapm.mdf' cannot be used by RESTORE. Consider using the WITH MOVE option to identify a valid location for the file.
I have got the two filenames i.e."ap0data" and "ap0log" by using the command "restore fileslistonly from disk = c:dba.bak".
-- Initialize Control Mechanism DECLARE@Drive TINYINT, @SQL VARCHAR(100)
SET@Drive = 97
-- Setup Staging Area DECLARE@Drives TABLE ( Drive CHAR(1), Info VARCHAR(80) )
WHILE @Drive <= 122 BEGIN SET@SQL = 'EXEC XP_CMDSHELL ''fsutil volume diskfree ' + CHAR(@Drive) + ':'''
INSERT@Drives ( Info ) EXEC(@SQL)
UPDATE@Drives SETDrive = CHAR(@Drive) WHEREDrive IS NULL
SET@Drive = @Drive + 1 END
-- Show the expected output SELECTDrive, SUM(CASE WHEN Info LIKE 'Total # of bytes : %' THEN CAST(REPLACE(SUBSTRING(Info, 32, 48), CHAR(13), '') AS BIGINT) ELSE CAST(0 AS BIGINT) END) AS TotalBytes, SUM(CASE WHEN Info LIKE 'Total # of free bytes : %' THEN CAST(REPLACE(SUBSTRING(Info, 32, 48), CHAR(13), '') AS BIGINT) ELSE CAST(0 AS BIGINT) END) AS FreeBytes, SUM(CASE WHEN Info LIKE 'Total # of avail free bytes : %' THEN CAST(REPLACE(SUBSTRING(Info, 32, 48), CHAR(13), '') AS BIGINT) ELSE CAST(0 AS BIGINT) END) AS AvailFreeBytes FROM( SELECTDrive, Info FROM@Drives WHEREInfo LIKE 'Total # of %' ) AS d GROUP BYDrive ORDER BYDrive
I am trying to setup a test cluster and am having an issue. When I try to create the resource of a physical disk it takes both the drive e: and drive q: and doesn't seperate them into two physical disks as resources. This means when I try to associate the quorum disk it links the to physcial disk resource of drive e and q. Then when I try to install SQL2k5 I get the warning about installing SQL on the quorum disk. Am I missing something? Is there a way to seperate e and q onto two physical disk resources so I can specifically associate the quorum to q and the sql to e or should I be setting the quorum disk to a majority node set? Thanks in advance.
I have a MSSQL7 data file mydata_data.mdf that I would like to load into my MSSQL7. When I try to restore to my database, I got an error message saying MSSQl does not recognize the file as a valid backup file.
I am using MS SQL 2005 Express. I have a database with two filegroups, the PRIMARY default filegroup, and then filegroup X. I have a backup of the PRIMARY filegroup only, and am trying to restore it to my database. When I select the .bak file to restore from, I am NOT given any 'backup sets to restore' - I therefore cannot select the filegroup to restore it. Can anyone advise? (NOTE - I have backed up the transaction log on the database I am restoring to already) Thanks MArco
It’s a classical ASP ( not .net ) website and it has a sql server 2000 backend database. I’m moving the website to a new windows 2003 server with sql server 2005 standard edition. The hosting company ( Godaddy ) of the website refused to give me the mdf & ldf files for security reasons so they only allow to give .bak files.
I restored the database to sql server 2005 using the .bak file , the sql server has SQL server authentication, and everything seemed to be nice.
The problem is : The database has a user name and he is the owner of the database schema. When I try to login with it the sql server says invalid login.
How to change the PASSWORD of this user after the backup?
I tried other scenarios to solve the problem but with no hope…. Some of them were: •I added a new user to the SERVER security node, and I mapped it to the database schema, it worked fine BUT : all SQL statements in the code are like “ SELECT * from table� not “SELECT * FROM scehma.table�… so I don’t think the user was mapped correctly? •I tried to delete the old user, but sql server said that he is the owner of the schema.
The only solution I have now is to change all sql statements in the code to be like “SELECT * FROM schema.table “… which will be a GREAT PAIN.