Fix Suspended Database steps,and reset mirroring

-- Removemirroring

ALTER DATABASE token SET PARTNER off

-- dropdatabase on secondary

drop DATABASE token

--disable job on primary

USE msdb;

GO

EXECdbo.sp_update_job

@job_name = N‘LSBak_token‘,

@enabled = 0;

GO

-- backup database on primary and copy to secondary

Backup database token  TODISK=‘c:\MSSQL\DATA\token.bak‘

Backup log token TO DISK=‘c:\MSSQL\DATA\token_log.bak‘

--restore database on secondary

restore database token from DISK=‘c:\MSSQL\DATA\token.bak‘

with norecovery

restorel og token from DISK=‘c:\MSSQL\DATA\token_log.bak‘

with norecovery

-- setmirroring on secondary

ALTER DATABASE token SET PARTNER = ‘TCP://CPCWRBISQLATP03:5022‘

-- setmirroring on primary

ALTER DATABASE token SET PARTNER = ‘TCP://CPCWRBISQLATS03:5022‘

-- enablejob on primary

USE msdb;

GO

EXECdbo.sp_update_job

@job_name = N‘LSBak_token‘,

@enabled = 1;

GO

Q:

Msg 3101,Level 16, State 1, Line 1

Exclusiveaccess could not be obtained because the database is in use.

Msg 3013,Level 16, State 1, Line 1

BACKUP LOG is terminating abnormally.

A:checkthe session for databasename, and kill it. try again.

sp_who2

kill 55

时间: 2024-10-22 21:19:02

Fix Suspended Database steps,and reset mirroring的相关文章

P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1

P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1       May 2016 Contents About This Guide...................................................................................... 11 Shared Topics in This Guide .

P6 EPPM Manual Installation Guide (Oracle Database)

Contents Oracle Database Manual Configuration Overview ,,★★5 Oracle Database Installation ,,★★6 Creating the Database Structure for Oracle and Loading Application Data ,,★★7 Creating the P6 EPPM Database Structure for Oracle ,,★★7 Copying the Script

CentOS 7 / RHEL 7 : Reset / Recover forgotten root password

CentOS 7 / RHEL 7 : Reset / Recover forgotten root password October 11, 2014 by sharad chhetri 4 Comments In this post we will learn, how to reset / recover forgotten root password on CentOS 7 / RHEL 7 (Red Hat Enterprise Linux 7). On RHEL 5/6 or Cen

How to handle null database fields with Java

Content is king and large software cannot get away from serving content. In this post, I shall document how to use Java to access relational databases, with the MySQL database as an example. Suppose we have created a database instance with two tables

SQL Mirroring[Hot back up with Double machine]

Background: It's fairly common for businesses to want to provide some high availability for their SQL Server databases, and one option is to have two SQL Server databases on separate machines with a SQL Server database mirrored. Microsoft provides mi

Managing database evolutions

When you use a relational database, you need a way to track and organize your database schema evolutions. Typically there are several situation where you need a more sophisticated way to track your database schema changes: When you work within a team

OCP读书笔记(24) - 题库(ExamD)

301.Which command is used to configure RMAN to perform a compressed backup for every backupexecuted?A. BACKUP AS COMPRESSED BACKUPSET DATABASEB. BACKUP AS COMPRESSED COPY OF DATABASEC. CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSETD.

Microsoft SQL Server Version List(SQL Server 版本)

原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Service Packs (SP), Cumulative Updates (CU), patches, hotfixes and other builds of MS SQL Server 2014, 2012, 2008 R2, 2008, 2005, 2000, 7.0, 6.5 and 6.0 tha

053(七十二)

356. 356.Which of the following commands will perform an active database duplication of the ORCL database to the ORCL2 database? A. Set oracle_sid=orcl rman target=sys/robert auxname=sys/Robert@orcl2 create duplicate target database to neworcl from a