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

AI Hentai Generator
Generate AI Hentai for free.

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

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

To create a scheduled task in Oracle that executes once a day, you need to perform the following three steps: Create a job. Add a subjob to the job and set its schedule expression to "INTERVAL 1 DAY". Enable the job.

The amount of memory required for an Oracle database depends on the database size, workload type, and number of concurrent users. General recommendations: Small databases: 16-32 GB, Medium databases: 32-64 GB, Large databases: 64 GB or more. Other factors to consider include database version, memory optimization options, virtualization, and best practices (monitor memory usage, adjust allocations).

Oracle Database memory requirements depend on the following factors: database size, number of active users, concurrent queries, enabled features, and system hardware configuration. Steps in determining memory requirements include determining database size, estimating the number of active users, understanding concurrent queries, considering enabled features, and examining system hardware configuration.

Oracle listeners are used to manage client connection requests. Startup steps include: Log in to the Oracle instance. Find the listener configuration. Use the lsnrctl start command to start the listener. Use the lsnrctl status command to verify startup.

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())
