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加密

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters


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

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use
