zoukankan      html  css  js  c++  java
  • Oracle数据库备份实验笔记[不完整,内容乱]

    rman target / log=/orasoft/backup/${DATE}backup1.log <<EOF
    run {
    allocate channel c1 device type disk;
    allocate channel c2 device type disk;
    allocate channel c3 device type disk;
    backup database format '/orasoft/backup/db_%T%U.bak';
    backup current controlfile format '/orasoft/backup/ctl_%T_%U';
    backup spfile format '/orasoft/backup/spfile_%T_%U';
    release channel c1;
    release channel c2;
    release channel c3;
    }
    EOF


    #####实验1

    #创建测试数据
    create table test1a(id int) tablespace users;
    insert into test1a values (1);
    select * from test1a;
    commit;

    #开始备份
    alter tablespace users begin backup;
    cp users01.dbf -t ~/backup/
    alter tablespace users end backup;

    #模拟物理损坏
    rm users01.dbf

    #清内存(这条语句不太好使)
    SQL> alter system flush buffer_cache;
    alter system checkpoint;


    #恢复备份文件
    cp ~/backup/users01.dbf -t ./

    #恢复
    alter tablespace users offline immediate;
    recover tablespace users;
    alter tablespace users online;

    #恢复完成

    select * from test1a;





    #####实验2

    #备份
    RMAN> backup tablespace users;
    上面命令的备份文件放到了如下路径:
    /home/zhang/app/zhang/product/11.2.0/dbhome_1/dbs

    #恢复
    [zhang@pi zhang]$ rman target /
    sql "alter tablespace users offline immediate";
    RMAN> restore tablespace users;//现在数据库还不能用,但是表空间的文件已经恢复了
    RMAN> recover tablespace users;
    RMAN> sql "alter tablespace users online";  

    #恢复完成




    #####实验3

    #备份就是手工copy dbf文件的方式备份(同实验1)

    #恢复
    SQL> alter tablespace users offline immediate;
    SQL> recover tablespace users;   
    SQL> alter tablespace users online;

  • 相关阅读:
    H3BPM子表的复制
    vue规格新增一对多的例子
    vue自制switch滑块
    table垂直居中
    css清楚浮动的class
    网页之间的参数传递
    调用get_str_time(时间), 就能把毫秒的时间转换成格式化的 ,转化时间戳的方法
    css实现照片上传的加号框
    递归函数获得n个不重复的随机数
    随机生成n个不重复的数,范围是2-32,并让其在新页面打开
  • 原文地址:https://www.cnblogs.com/vanwoos/p/7805166.html
Copyright © 2011-2022 走看看