How to delete system database in sql server 2008 R2 [closed] - sql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I was deleted database, using the command "Drop database msdb"
It shows Cannot drop the database 'msdb' because it is a system database.
i want to know how to delete system database.
Any help?

No,you cannot drop system databases ..From mannual msdb Database
The msdb database is used by SQL Server Agent for scheduling alerts and jobs and by other features such as SQL Server Management Studio, Service Broker and Database Mail.
Restrictions
The following operations cannot be performed on the msdb database:
Changing collation. The default collation is the server collation.
Dropping the database.
Dropping the guest user from the database.
Enabling change data capture.
Participating in database mirroring.
Removing the primary filegroup, primary data file, or log file.
Renaming the database or primary filegroup.
Setting the database to OFFLINE.
Setting the primary filegroup to READ_ONLY.

This database can't be deleted:
See restrictions:
Dropping the database.
http://technet.microsoft.com/en-US/en-en/library/ms187112.aspx

Related

How to do regular Azure SQL Server bacpac extracts to save on-prem [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I know Azure does its own backups in the cloud. However, due to company policy I need to generate a local backup copy of the database and be date-time stamped.
I've read this, and it has allowed me to create a .bacpac file and import it into our on-prem SQL server (2019). What I want is a way to save the bacpac file on a network folder, on a regular basis.
UPDATE - no I don't have to, store the bacpac file in an on-prem database. I only mentioned it to say, yes I can do this extra step. What I really want is to simply save the bacpac file, date-stamped in the filename, and in a network folder on-prem.
If you don't mind use third-part tool to regular backup Azure SQL database to local, please ref this blog: How to backup Azure SQL Database to Local Machine. It provides all the way to backup the Azure database to local, include regular backup features.
This blog provide the tools SqlBackupAndFtp to help us regular backup the database. The output .bacpac backup file name schema example like this: Mydatabase202103250956, databasename+date.
It also give the tutorial to Backup Azure SQL Database Using BCP Utility:
bcp sqlftpbackupdb.SalesLT.CustomerAddress out c:\sqlfile\cust.dat -c -U daniel -S tcp:sqlftpbackupserver.database.windows.net
You also could ref the official document: https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-export?WT.mc_id=DP-MVP-5001259&view=sql-server-ver15.
HTH.

SQL Server Transactional Replication and Users and Roles [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
With SQL Server Transactional Replication, is it possible to also replicate users and roles from the source to the target database? This is not something I am able to do.
No, with Transactional Replication you cannot replicate users and roles from source to target. A list of database objects that can be published using Transactional Replication is listed in Publish Data and Database Objects.
You will need to deploy the users and roles from source to target database using a pre or post snapshot script. For information on pre and post snapshot scripts refer to:
Execute Scripts Before and After the Snapshot is Applied
Execute Scripts Before and After the Snapshot is Applied (SQL Server Management Studio)
Configure Snapshot Properties (Replication Transact-SQL Programming)

Hiding databases for a login on Microsoft Sql Server 2008R2 and above [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Please can anyone assist with hiding the available databases on sql server 2008R2 or newer versions.
I have a new login user that I mapped to a specific database.
When logging in with the specific login user I can see all the databases on the server, although I cannot access them except for the one I mapped to the login.
This is 100% but my problem is that I do not want the login to even see that those other databases are available.
How do I prevent those other databases that are not mapped to the login from displaying?
USE master;
GO
DENY VIEW ANY DATABASE TO [newlogin];
GO
USE yourDB;
GO
DROP USER newlogin;
GO
USE master;
GO
ALTER AUTHORIZATION ON DATABASE::yourDB TO [newlogin];
GO
Raj

How to copy SQL Azure schema to another SQL Azure database? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I have developed/managed my dev database in SQL Azure, but I can't figure out how to copy the schema of my dev SQL Azure database so I can upload it to my production SQL Azure database? I have heard of other third party tools, but is this the best way? If so, what is a good tool to use for this?
http://sqlazuremw.codeplex.com/ is also a quite simple to use and efficient tool
If your production database is empty and you just need to clone your current dev database -
you can export your DevDB to .bacpac file and then import back it on production server.
Old portal have that functionality there: Database->subscription->server->Pick database, import\export on the top.
New portal: DB, click on servers tab, select server -> databases tab, Import\Export buttons on bottom panel
If you need just migrate your schema to production database, which filled with data and should't be interrupted - you can create SQLProject type (if i remember correctly - you need SQL Server Data Tools, SSDT. Also its available with SQL2012 Tools\Studio) and then you can compare your Azure DB Schema to empty project and script schema back to sql constructs. Then just publish newly created scripts to your production database.
Two tools you should never do without when working with SQL are SQL Compare and SQL Data Compare by Redgate. They have saved me countless hours of work and will streamline what you want to do. I've used them with azure and they work well and do the job for us.
See http://www.red-gate.com/products/sql-development/sql-developer-bundle/
The first product will compare and create your schema and the second will let you synch your data. Sometimes it's just better to pay for the right tools and this is that case.
SQL Azure MW (http://sqlazuremw.codeplex.com/) works ok, although it did fall apart on me a couple of times when working with a lot of tables in the schema.
Another option is also Azure Data Sync, but as far as I know, it also doesn't want to work if you have more than 500 tables in your database.
What I did in the end is sqlcmd with the SQL dump of the database:
http://msdn.microsoft.com/en-us/library/windowsazure/ee336280.aspx
that took ages, but worked fine. The big problem is how to get it back locally :-)

SQL Server database security [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have SQL Server 2008 installed on Windows 2008 Server.
I've disabled built-in administrator password and created sa with sysadmin privileges.
Question is: Is there any way to access to database, or back it up. or methods to reset (and / or) get password for sa?
I want to secure my database.
Thanks.
I've disabled built-in administrator password...I want to secure my database.
If you think you can disable access to built-in administrators your are chasing a phantasm. Built-in administrators will always be able to access your database, the steps to gain access are clearly documented in Connect to SQL Server When System Administrators Are Locked Out. Your database must be deployed on a system on which you completely trust the system administrators, there is no work around for this basic requirement.
Most often this question is asked as some misguided attempt to protect the perceived IP in the database. The answer to that question is that what you want is called DRM and SQL Server does not offer DRM. If you are afraid of distributing the database to your users then use a service like SQL Azure.
Users who have to have access to the SQLCmd prompt would be be able to run perform such commands. You could access the database and reset passwords the console and do something like this:
ALTER LOGIN sa WITH PASSWORD = ‘newpassword’ UNLOCK