SQL Server Transactional Replication and Users and Roles [closed] - sql-server-2012

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)

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 stuck in single_user with auto_update_statistics_async on [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Books online states
Before you set the database to SINGLE_USER, verify the
AUTO_UPDATE_STATISTICS_ASYNC option is set to OFF. When set to ON, the
background thread used to update statistics takes a connection against
the database, and you will be unable to access the database in
single-user mode.
I got to know this only after the fact. What do I do now, when shutting down the entire instance is not an option as there are critical DB's on it as well?
I don't have the permission to kill the 'sa' login TASK MANAGER processes that the statistics update seems to use, and even having tried a brute-force trick where I'd just try to get into the DB some 3000 times in a row for a few times, doesn't help.
Even though I have the VIEW SERVER STATE permissions I can see no stats jobs by querying sys.dm_exec_background_job_queue so KILL STATS JOB doesn't appear to help.
Any advice is appreciated, thanks.

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

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

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

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