how do I backup logins and jobs from SQL server 2005? - sql-server-2005

Is there a script or function in sqlserver2005 that i can backup the jobs and login details of a server from the master database?

Jobs are stored in the MSDB database and logins in the Master database.
You can backup these system databases as you would any other of your user databases. Use the Management Studio GUI or via the "backup database.." TSQL syntax.
See this article on backing up your system databases. With specific considerations for the backing up master and backing up MSDB.

Related

Backup users in Azure SQL Database

IN my scenario need to take azure sql database backup and restore in another azure sql database server.I have done it using Export and Import . But i need to take the backup of users from one DB to another with permissions.
You can use the script for creating a script that can be run on the exported/imported database to create users. Here is the script -
https://dba.stackexchange.com/questions/190475/scripting-out-database-user-level-permissions
If the need is to move the On premises Logins to Azure SQL DB:There is a utility to move On-Premises SQL Server Logins to Azure SQL DB.
This scenario is documented in the Data Migration Assistant guide
Hope this helps.
Thanks
Navtej S

Is it possible to execute query to mirror database? (MS SQL Server 2012)

Is it possible to execute query to mirror database? Without stopping mirroring.
In database mirroring you can query the mirrored database only if you create snapshots of that database. In SQL Server 2012, database snapshot is an Enterprise feature.
https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2012/cc645993(v%3dsql.110)
If you run queries on the snapshot you'll lave to license it, and are a few things to consider, check link below.
https://learn.microsoft.com/en-us/sql/database-engine/database-mirroring/database-mirroring-and-database-snapshots-sql-server?view=sql-server-ver15
If you're willing to license Enterprise, you'd be better of implementing AlywasOn Availability Groups where you can have a readable secondary.

Migrate SQL Server database to Azure along with database email and jobs

I am new to SQL Azure, we have taken the subscription of Azure SQL elastic pool.
I have two databases in my local SQL Server and it has a stored procedure which internally is calling msdb.dbo.sp_send_dbmail and I have scheduled these stored procedures to run in a job (SQL Server Agent -> Scheduler).
I want to move these two databases along with DB-mail accounts and SQL Server jobs to Azure. I am finding difficulties as in my subscription I am not able to see msdb, SQL Server Agent and database email. We want to go with only SQL Azure as service, no need your support on these.
I tried to deploy the database and getting the error message:
Error
SQL71562: Error validating element [dbo].[AMPLoanAgingEMail]:
Procedure: [dbo].[AMPLoanAgingEMail] has an unresolved reference to object [msdb].[dbo].[sp_send_dbmail].[#profile_name]. External references are not supported when creating a package from this platform.
The expected result is I want to move those scheduled jobs and stored procedures to my Azure.
Azure SQL database doesn't support msdb database. We can not migrate msdb to Azure or do anything with it in Azure SQL database.
For more details, please see: msdb database.
SQL server agent is only supported Azure SQL Managed Instance only.
Database email also is not supported in Azure SQL Database.
This why you can not be able to see msdb , SQL server agent and database email.
Your stored procedure [dbo].[AMPLoanAgingEMail] could not call the [msdb].[dbo].[sp_send_dbmail] in msdb. The error message also mentioned that.
For now, there isn't a solution for msdb in Azrue SQL Database.
Before migrate your database to Azure SQL database, you can use Data Migration Assistant(DMA) to help you assess your database.
Hope this helps.

Where does SQL Server restore backup from if I select Database as the source?

When I restore an SQL server database from backup, I usually do it from a .bak file on the disk. There is also an option to restore from Database as a source - see this picture
Is this backup restored from the database log file?
It's from existing backups from databases that have been created on the server. It's essentially a list of all databases that have at least one recorded backup in the msdb database.
Source: MSDN
Select the database to restore from the drop-down list. The list contains only databases that have been backed up according to the msdb backup history.

SQL Server 2005 - are stored procedures named sp_MSdel_ related to replication?

I have a server here in my home office setup to receive push subscriptions from a server at our company HQ. I was looking through the list of stored procedures today and see many of them with 'sp_MSdel_' prepended. Are these related to replication? Can they/should they be deleted or left alone?
I don't see any of these types of stored procs on the main server.
Thanks!
These tables are for replication. Dont delete these procedures as the SQL Agent will have replication clean up jobs that will use these procedures and is internal to the MS replication configuration setting. Please leave them be.
They are for replication. Leave them.