RMAN 相应概念介绍
RMAN(recovery manager)是oracle提供的备份恢复工具。其实使用sql结合OS命令也可以执行备份恢复,也更为灵活,但是对于初学者来
RMAN(recovery manager)是Oracle提供的备份恢复工具。其实使用sql结合OS命令也可以执行备份恢复,也更为灵活,但是对于初学者来说还是使用rman这种方法比较好;
rman 用了管理备份、转储和恢复操作。该工具执行的命令统统在服务器进程执行,所以目标数据库必须处于mount或open状态,如果使用了恢复目录,那么恢复目录数据库要处于open状态;
先介绍几个rman里所用到的专有名词:
目标数据库:需要备份、转储和恢复的数据库;
恢复目录数据库:专门用来管理rman资料库(由执行rman操作是产生的元数据组成)的数据库,同时会在目标数据库的控制文件中保存,但是控制文件中的信息受时间限制(control_file_record_keep_time 默认7天);
通道:当执行rman操作时需要在目标数据库和存储设备之间建立连接,称作通道(channel),可以配置多个;
rman 特点:可以备份数据库、表空间、数据文件、控制文件、归档日志、spfile;不能备份重做日志、pfile和口令文件;如果需要定期执行备份,那么可以将这些rman操作放在一些脚本文件中(使用脚本必须使用恢复目录);rman备份是只备份用过的block;
连接到目标数据库
只有sysdba角色的用户才能登陆;
--不使用恢复目录
rman target sys/admin@orcl nocatalog;
--使用恢复目录
rman target sys/admin@orcl catalog rm_user_name/rm_user_passwd@orcl_far
使用恢复目录数据库时的操作:
首先在改数据库上创建一个专门用来管理catalog的用户,并赋予connect、resource、recovery_catalog_owner 三个角色;
然后 create catalog 创建catalog
然后连接上目标数据库
register database; 注册数据库;在任何时候你可以用 unregister database 去注销数据库的注册;这时会丢失掉控制文件内所为保存的备份信息(一般是7天之外的信息丢失);并且里面的脚本文件也丢失; 如果时间在7天之内,那么可以重新注册,那么rman会执行resync catalog从目标数据库中的控制文件中把这几天的备份信息同步到恢复目录;如果没有自动执行,那么可以手动执行。
也可以在rman提示符下(与上面两条照应)
rman nocatalog
connect target sys/admin@orcl
rman
connect target sys/admin@orcl
connect catalog rm_user_name/rm_user_passwd@orcl_far
rman 里执行sql语句的格式 SQL 'alter system archive log ';
如果sql语句中有单引号,那么需要在单引号处再加一个单引号转义,然后把整个sql的单引号换为双引号;
show all 显示所有的rman的配置;
report schema 列出目标数据库的表空间、数据文件及临时文件;
report obsolete 列出废弃的备份;
report unrecoverable 列出不可恢复的备份;
list backup 列出备份的详细信息;
list script names 列出存储脚本名称;
list backup summary 列出备份摘要信息;
delete backup 删除所有的备份;
delete obsolete 删除所有的过期的备份;
backup database; 备份数据库
backup tablespace users ;备份users表空间;
backup datafile 6 ;备份6好数据文件;
backup spfile format=’d:\backup\%d_%s’; 备份spfile文件;
backup incremental level 0 tablespace users; 0级别增量备份;
backup incremental level 1 tablespace users; 1级别增量备份;
--在执行累计备份时,需要先执行一个0级增量备份;
backup incremental level 0 tablespace users; 0级别增量备份;
backup incremental level 1 cumulative tablespace usres; 1级累计备份;
启动到mount状态
rman target sys/admin@orcl rm_user_name/rm_user_passwd@orcl_far
restore database; 转储数据库
recover database; 恢复数据库
打开数据库
创建存储脚本
cereate script bak_script{backup datafile 6; slq ‘alter system archive log current’;}
运行脚本
run{execute script bak_script;}
显示脚本信息
print script bak_script
删除脚本
delete script bak_script
升级恢复目录
upgrade catalog 这时会提示你再执行一次该命令,进行升级,,如果不执行,那么可以知道rman是那个版本的;
删除恢复目录
drop catalog;
推荐阅读:
Oracle基础教程之通过RMAN复制数据库
RMAN备份策略制定参考内容
RMAN备份学习笔记
Oracle数据库备份加密 RMAN加密

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Oracle views can be exported through the EXP utility: Log in to the Oracle database. Start the EXP utility, specifying the view name and export directory. Enter export parameters, including target mode, file format, and tablespace. Start exporting. Verify the export using the impdp utility.

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

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.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node
