vendor did a full backup for his database and put some folder not being backed up by TSM, he is the owner of the database, and delete his backup later. The backup is not copy only, all the differential and log backups taken are based on his FULL backup. so they cannot be restored.
QUESTION: To prevent this happen in the future, what is the normal practices? or any way to prevent db_owner to do the ad-hoc full backup? I am thinking of using DENY backup database, or write a policy claiming no responsibility if vendor make it happen again.
Backing up all databases on a sql server that hosts secondary high availability databases as well as other databases. The other databases back up fine, but the high availability secondaries all get the same error:
BackupDiskFile::OpenMedia: Backup device 'F:MSSQLBackupdbnamedbname_backup_2015_MM_DD_tttttt_ttttttt.bak' failed to open. Operating system error 2(The system cannot find the file specified.)
I put the database in emergency mode, then I executed Checkdb, it shows no errors. The database status is still EMERGENCY and when I try to bring it online, it says he database is in single-user mode, and a user is currently connected to it. There is one processes which is accessing the database, i try to kill it, but it is not going. I am not able to set database to multi user.
When I right in Microsoft SQL Server Management Studio on the database > Take Offline
Set offline failed for Database 'OperationsManagerAC'.
Transaction (Process ID 56) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. ALTER DATABASE statement failed. (Microsoft SQL Server, Error: 1205)
So I am trying with some queries to pass the database from Single user to multi user but it fails
USE [master] GO ALTER DATABASE OperationsManagerAC SET MULTI_USER GO Msg 1205, Level 13, State 68, Line 1</p><p>Transaction (Process ID 52) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. Msg 5069, Level 16, State 1, Line 1 ALTER DATABASE statement failed.
I tried also
alter DATABASE OperationsManagerAC SET OFFLINE WITH ROLLBACK IMMEDIATE
IT FAILS AS WELL... with the same error... how to run the SQL Statements without using
Is there a way to monitor all ODBC connections to a MSSQL server and prevent a username/ODBC combination. My problem is that we have many frontends for viewing reports, but we managed them all and users are not allow to make their own connections. Some users now uses MSAccess over ODBC to draw their own reports - they have all the permissions as neededd by the other apps.
How can I prevent a colleage to delete tables in a specific database. Yes he has access to Enterprise Manager. We would like to allow him read only to the live databases.
hi this is raja sekar.k from bangalore,i need to know how to make a webform with the "BACKUP SQL DATABASE " from a user.. if it is possible.. please help me ..thanksregards Raja Sekar.kChola software consulting pvt ltd..Bangalore
I need to have an Application owner backup a SQL Server dbase after his updates. Im not that familiar with ISQL. He does not have EM installed on his machine. What minimum installments do I have to do on his machine for him to log into SQL Server, after I create a login for him ? Once in the command window I would give him the script of isql -Usa -Ppassword -SSqlServerA -Q "BACKUP DATABASE [test] TO DISK = N'E:Program FilesMicrosoft SQL ServerMSSQLBackupdbase1' WITH NOINIT , NOUNLOAD , NAME = N'test backup', NOSKIP , STATS = 10, NOFORMAT"
In order to take automated backup of all user databases below is the query. This query will eliminate use of manual backups for user databases, in order to fully automate this just create a SQL Agent job and write this query in the job and forget about taking any manual DB backups.
DECLARE @name VARCHAR(50) -- database name DECLARE @path VARCHAR(256) -- path for backup files DECLARE @fileName VARCHAR(256) -- filename for backup DECLARE @fileDate VARCHAR(20) -- used for file name SET @path = 'C:DB_BKPUP'
I manage a hosted environment - several actually. Meaning my company is the host. We provide some of our customers with a dedicated instance of SQL Server that they can use in read-only mode. Unfortunately, I have some very inquisitive customers who probably should be hosting their own SQL. They like to poke into the inner workings of our environment in ways that make me uncomfortable. What I originally found was that they were reading our server registry. I've disabled that. The next thing that bothers me is the amount of information available to them through SERVERPROPERTY. They don't need to know things like physical node of a cluster their instance is on, or the last time we updated SQL, or our licensing choices.
Is there any way to prevent a user from using the SERVERPROPERTY function? I've done a lot of digging and can't seem to find a way to do it.
I got full backup on daily schedule its taking more space on Drive because each file has more than 25GB.I am using SLQ server 2008R2 so I'm looking to take the backup with compression instead of uncompressed Backup. What are the impacts of compressed backup. Is there any problems with compressed backup while restoring the backup file.
I have an MSSQL server where I would like to create a couple of databases, create one user pr. DB, and give them db_owner permissions.
Giving a user db_owner permissions allows the user to make a backup of the database, which is a good thing and I would like it to stay that way.
My problem is that I don't know how to restrict the user from saving the backup to any directory or filename that he wants to. He can not get out of the directories that the user MSSQL is running under has access to. But he can overwrite another users backupfile or placing the file in the MSSQL-programfolder.
The users is using SQL Server authentication.
Can I restrict the backup procedure to save to only one file or in one directory?
What is the best practice regarding backup if you give your users db_owner permissions?
I have a problem with databases that are left in single user mode after transaction log backup. I have a database maintenance plan job that backs up the transaction log and checks data and index linkage every hour. Sometimes the job fails and when I look in the report file it says that it has tred to put the database in single user mode and failed because the database is in use and then in the next step it says that it cannot perform the operation because there already is a user in the database.
Why is the database put in single user mode? What can I do to avoid finding my databases in single user mode?
Below is a part of the report file:
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 15089: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot change the 'single user' option of a database while another user is in the database. [1] Database BV Produktion: Check Data and Index Linkage...
** Execution Time: 0 hrs, 0 mins, 1 secs **
[2] Database BV Projektering: Check Data and Index Linkage... [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 924: [Microsoft][ODBC SQL Server Driver][SQL Server]Database 'BV Projektering' is already open and can only have one user at a time. [Microsoft][ODBC SQL Server Driver][SQL Server]Only the owner of object 'dms_user' can run DBCC CHECKTABLE on it. [Microsoft][ODBC SQL Server Driver][SQL Server]Database 'BV Projektering' is already open and can only have one user at a time. [Microsoft][ODBC SQL Server Driver][SQL Server]DBCC execution completed. If DBCC printed error messages, contact your system administrator.
The following errors were found:
[Microsoft][ODBC SQL Server Driver][SQL Server]Database 'BV Projektering' is already open and can only have one user at a time. [Microsoft][ODBC SQL Server Driver][SQL Server]Only the owner of object 'dms_user' can run DBCC CHECKTABLE on it. [Microsoft][ODBC SQL Server Driver][SQL Server]Database 'BV Projektering' is already open and can only have one user at a time. [Microsoft][ODBC SQL Server Driver][SQL Server]DBCC execution completed. If DBCC printed error messages, contact your system administrator. ** Execution Time: 0 hrs, 0 mins, 9 secs **
Hello. I am trying to perform a backup and restore of a user's default database. the user- "myuser", was created with a default database. I have backed the user database and tried to restore it in different ways and I always get the same error when trying to connect with the user after restore:
"Cannot open user default database.Login failed (error 4064)".
It happens if I don't delete the user before restoring the database.
If I try to delete the user before restore and create it afterwards, when I try to set the default user database to the same database I get the error:
"user, group or role 'myuser' already exist in the database"
And when I try to delete the user from the restored database (in order to recreate it) I cannot, because the user's schema is connected to objects in the database.
Can anyone help?... How do I restore?? Thanx, Nili.
My goal is to write a DR plan where i am restoring all user databases onto a diffrent server in a event of hardware failure. I was trying to figure out a way to extract DDL of user accounts and their permissions on all user databases so i can simplify my DR documentation.
This is the plan I came up with...to restore all system and user dbs on a different Physical SQLServer.
1. build named instance $PROD
2. restore master database
- startup sqlserver in single user mode -m or DAC sqlcmd -S ServerName -U sa -P<xxx> –A net stop MSSQLSERVER$PROD net start MSSQLSERVER$PROD -m - restore database master from disk e:master.bak with replace;
3. start sqlserver normally
4. stop SQLServer agent
5. restore msdb
-restore database msdb disk e:msdb.bak with replace;
I created account with permissions in order my program (I use C#.net) can connect to SQL Server 2008 by this account But I don't want that user can use this account to login to DB by SQL Management Studio for security purpose So how to prevent user login to SQL Management Studio ?
Can I setup "db_denydatareader" to MASTER db to prevent the access ?
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.
Are there ways in SQL server to deny connecting to a instance? Basically i am looking for a way where data is accessed only through application , even the DBA's shouldn't have access to the data though they are sysadmins? Someone told me this is possible in SQL 2014? This is only for individual access, i know i can put some encryption in app layer.
I am restoring a backup of sql server 2005 which I inherited on to sql server 2012 and is in a recovery pending state and the reason why is, this is a backup from a different domain and does not have the logins from the legacy domain, looks like its some access issue as its not being able to find the necessary login on sql server 2012.
I have three instances running on my sql 2008 r2 enterprise.I have taken full backup of one database from default instance.I login both the instances thru sa account.Now when I try to restore that backup on another instance it gives me the following error....
TITLE: Microsoft SQL Server Management Studio Restore failed for Server 'WRCP2F1CWS315TEJA'. (Microsoft.SqlServer.SmoExtended) System.Data.SqlClient.SqlError: The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAfcms.mdf'. (Microsoft.SqlServer.Smo)
what can be done to restore bakup in another instance ...
In one off my production box, we are notable to take a backups of MSDB . When i look at the error, it is failing locate allocation unit ID.. complete error as below
Msg 2533,Sev 16,State 1, Line 36 : Table error : Page (1:111720 ) allocated to object id 110623437, index ID 1, Partition ID 72057594043432960, alloc unit ID 72057594044874752 (type-inrow data) was not seen. This page is invalid or may have an incorrect alloc unit ID in its header.[SQLSTATE 42000]
Due this failure, we are unable to take the backup of MSDB database and our integrity check and reindex jobs also failured with the same.Also, I could see events of I/O issues with underlaying hard dirve with following name
DeviceHarddisk0DR0,has a bad block.
1. I dont no what could happen if restart my server, Question is: Does it recognize MSDB during server statup.
how to prevent the insertion of the same entry of an unique value into the database? assume that I have a primary key username " abc" in the database and then I insert the "abc" again ,the debuggging error msg pops out saying the primary key cannot be duplicated.. how can I do an if--else statement to check the database against this unintentional inputs of the same unique data " abc"???
We utilise SQL scripts, executed via sqlcmd.exe, to upgrade the schema and common data of our database(s) when we deploy new versions of our software to a production site. At the moment we simply wait until after hours to do the upgrade and ask nicely for all users to not use the system for a while.
Obviously, asking nicely doesn't always work, and there is also the issue of scheduled server tasks and web services / web sites that operate against the database 24/7.
What are our options for putting the entire server (or preferrably just one database) into a semi-offline state so that users and services cannot connect to it while our script connects and performs the upgrade? I imagine there may be several approaches each with their own pros and cons.
If you could point me in the right direction or perhaps mention what strategy has worked for you, it would be greatly appreciated. We perform these upgrades from hundreds of kilometers away via VPNs and Remote Desktop so we can't just unplug the network cable :).
Does anyone have a good strategy or technique for preventing database drops in SQL Server 2000? I know in 2005 DDL triggers rock, but in 2000 what can you do to audit who drops a database why keeping the same permissions intact.