search
HomeDatabaseMysql Tutorialsql 数据库分卷备份和还原

执行数据库恢复是DBA的日常生活的一部分。一个DBA可能需要执行恢复由于种种原因,如恢复,刷新数据库用于测试目的等许多倍,它可能很难执行恢复由于损坏的媒体,在服务器上的磁盘空间不足等。在这篇文章中,我将概述的方法之一,我用来恢复的备份生产数据库的

方案
夫妇的日子,我的支持团队的成员来找我,说他们是无法刷新农行从生产服务器相同的的备份副本名为OLTP开发环境数据库。从生产服务器的备份副本大约75 GB的大小。在我们的开发机中,我们只有1专门为SQL Server,这是留下的自由空间仅70 GB驱动器(D)。

恢复解决方案
有一个详细了解后,我来到了一个结论,我不能释放任何空间上的D盘的开发机。很重要的一点要提到的是,我们整个的开发机在不同的域比分期和生产箱。

我登录到生产服务器,并决定分成相等的两部分使用如下所示的T - SQL的名为ABC的数据库备份:

 代码如下 复制代码
BACKUP DATABASE ABC
TO DISK='B:DB BackuABC_1.bak',
DISK='B:DB BackupsABC_2.bak'
GO

一旦上述的T - SQL语句块被执行,它分割成相等的两部分命名为农行目前在生产服务器上的数据库的完整备份。例如,如果数据库的大小是76 GB,那么它将会分成两个等份,每一个大小为36 GB。

一旦被分裂成两等份的完整备份,然后我就可以执行对他们的RAR。显然首先执行的RAR,然后将它们移动到不同的服务器会比移动一个规模更大的正本更快。一旦分割文件压缩成功,然后我走上了我的临时服务器。这是因为临时框是不错的,在资源方面也因为的生产和临时服务器复制过程在不同的数据中心,由于良好的硬件工作得更快。正如前面所讨论的自由空间的开发OLTP中仅有70 GB,而备份副本为75 GB,因此是不可能的开发OLTP中传输完整备份压缩的副本。我有另一个框,这是作为一个SSIS开发服务器与大量的自由空间使用。它们如下:

驱动器D有49.9 GB的可用空间

驱动器C有55 GB的可用空间

开发机独立的机器,而不是一个集群,因此有1备份的压缩文件复制到C驱动器没有问题。

然后,我走上了开发SSIS服务器和名为Backup_03102011_DB目前对D盘的文件夹到其他的压缩文件的驱动器C的命名备份文件夹,压缩文件的一个副本。我给这两个文件夹的全部权限。

 代码如下 复制代码

RESTORE DATABASE ABC
 FROM DISK='\10.A.A.AbackupsABC_1.bak',
DISK='\10.A.A.ABackup_03102011_DBABC_2.bak'
WITH MOVE 'ABC_Data' TO 'D:Program FilesMicrosoft SQLServerMSSQL.1MSSQLDataABC_Data_1.mdf',
MOVE 'ABC_Log' TO 'D:Program FilesMicrosoft SQLServerMSSQL.1MSSQLDataABC_Log.ldf'
GO

凡10.AAA是dev的机器的IP地址。

一旦成功地执行了上述T - SQL代码块,然后,我改变了对名为ABC的数据库执行以下查询SA数据库的所有者。

 代码如下 复制代码
Exec sp_changedbowner ‘sa’

下一步涉及映射孤立用户。为了找到孤立的用户,您需要执行对ABC数据库上开发OLTP机下面的T - SQL查询

 代码如下 复制代码
sp_change_users_login @Action='Report'


一旦上面的查询执行时,它会列出所有孤立用户名为ABC的数据库中。为了解决这个问题,则需要执行下面的T - SQL查询:

 代码如下 复制代码
exec sp_change_users_login @Action='update_one', @UserNamePattern='User Name', @LoginName='Login Name';
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain the role of InnoDB redo logs and undo logs.Explain the role of InnoDB redo logs and undo logs.Apr 15, 2025 am 12:16 AM

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

What are the key metrics to look for in an EXPLAIN output (type, key, rows, Extra)?What are the key metrics to look for in an EXPLAIN output (type, key, rows, Extra)?Apr 15, 2025 am 12:15 AM

Key metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.

What is the Using temporary status in EXPLAIN and how to avoid it?What is the Using temporary status in EXPLAIN and how to avoid it?Apr 15, 2025 am 12:14 AM

Usingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB

Describe the different SQL transaction isolation levels (Read Uncommitted, Read Committed, Repeatable Read, Serializable) and their implications in MySQL/InnoDB.Describe the different SQL transaction isolation levels (Read Uncommitted, Read Committed, Repeatable Read, Serializable) and their implications in MySQL/InnoDB.Apr 15, 2025 am 12:11 AM

MySQL/InnoDB supports four transaction isolation levels: ReadUncommitted, ReadCommitted, RepeatableRead and Serializable. 1.ReadUncommitted allows reading of uncommitted data, which may cause dirty reading. 2. ReadCommitted avoids dirty reading, but non-repeatable reading may occur. 3.RepeatableRead is the default level, avoiding dirty reading and non-repeatable reading, but phantom reading may occur. 4. Serializable avoids all concurrency problems but reduces concurrency. Choosing the appropriate isolation level requires balancing data consistency and performance requirements.

MySQL vs. Other Databases: Comparing the OptionsMySQL vs. Other Databases: Comparing the OptionsApr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

How does MySQL index cardinality affect query performance?How does MySQL index cardinality affect query performance?Apr 14, 2025 am 12:18 AM

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

MySQL: Resources and Tutorials for New UsersMySQL: Resources and Tutorials for New UsersApr 14, 2025 am 12:16 AM

The MySQL learning path includes basic knowledge, core concepts, usage examples, and optimization techniques. 1) Understand basic concepts such as tables, rows, columns, and SQL queries. 2) Learn the definition, working principles and advantages of MySQL. 3) Master basic CRUD operations and advanced usage, such as indexes and stored procedures. 4) Familiar with common error debugging and performance optimization suggestions, such as rational use of indexes and optimization queries. Through these steps, you will have a full grasp of the use and optimization of MySQL.

Real-World MySQL: Examples and Use CasesReal-World MySQL: Examples and Use CasesApr 14, 2025 am 12:15 AM

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.