zoukankan      html  css  js  c++  java
  • ORACLE备份还原

    ----------------------------------*备份数据库*----------------------------------
    1、WINDOWS(图标)+R --> CMD
    2、SQLPLUS HUAWEI/RSGL@127.0.0.1/ORCL
    3、SHOW PARAMETER DEFERRED_SEGMENT_CREATION;(如果为TRUE,则将该参数改为FALSE)
    4、ALTER SYSTEM SET DEFERRED_SEGMENT_CREATION=FALSE;
    5、SELECT 'ALTER TABLE '||TABLE_NAME||' ALLOCATE EXTENT;' FROM USER_TABLES WHERE NUM_ROWS=0 OR NUM_ROWS IS NULL;
    6、EXP HUAWEI/RSGL@127.0.0.1/ORCL FILE=D:HUAWEIHUAWEI.DMP LOG=D:HUAWEIHUAWEI.LOG OWNER=HUAWEI
    ---------------------------------*删除原表空间*---------------------------------
    1、WINDOWS(图标)+R --> CMD
    1、SQLPLUS /NOLOG
    2、CONN /AS SYSDBA
    3、DROP USER HUAWEI CASCADE;
    4、DROP TABLESPACE HUAWEI INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
       DROP TABLESPACE HUAWEI_DATA INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
    5、重启ORACLE服务
    6、手动删除表空间文件(*.DBF)
    7、删除表空间时提示错误
       ORA-02429:无法用于删除强制唯一/主键的索引
     (1)SELECT 'ALTER TABLE ' || OWNER || '.' || TABLE_NAME || ' DROP CONSTRAINT ' || CONSTRAINT_NAME || ';'
        FROM DBA_CONSTRAINTS WHERE CONSTRAINT_TYPE IN ('U', 'P') AND (INDEX_OWNER, INDEX_NAME) IN
        (SELECT OWNER, SEGMENT_NAME FROM DBA_SEGMENTS WHERE TABLESPACE_NAME = 'HUAWEI');
        表空间:HUAWEI
     (2)执行查询的语句:ALTER TABLE HUAWEI_CPZX.A01 DROP CONSTRAINT SYS_C0051828;
     (3)重新删除表空间:DROP TABLESPACE HUAWEI INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
     (4)重启ORACLE服务
     (5)手动删除表空间文件(*.DBF)
    ----------------------------------*还原数据库*----------------------------------
    1、WINDOWS(图标)+R --> CMD
    2、SQLPLUS /NOLOG
    3、CONN /AS SYSDBA
    4、CREATE TEMPORARY TABLESPACE HUAWEI_TEMP TEMPFILE 'D:DataBaseOracleTableSpaceHUAWEI_TEMP.DBF' SIZE 500M AUTOEXTEND ON NEXT 50M MAXSIZE 20480M EXTENT MANAGEMENT LOCAL;
    5、CREATE TABLESPACE HUAWEI_DATA LOGGING DATAFILE 'D:DataBaseOracleTableSpaceHUAWEI_DATA.DBF' SIZE 500M AUTOEXTEND ON NEXT 50M MAXSIZE 20480M EXTENT MANAGEMENT LOCAL;
    6、CREATE USER HUAWEI IDENTIFIED BY RSGL DEFAULT TABLESPACE HUAWEI_DATA TEMPORARY TABLESPACE HUAWEI_TEMP;
    7、GRANT CONNECT,RESOURCE,DBA TO HUAWEI;
    8、IMP FILE=H:HUAWEIHUAWEI_2020_03_09_09_37.dmp LOG=H:HUAWEIHUAWEI_2020_03_09_09_37.log STATISTICS=NONE USERID=HUAWEI/RSGL@127.0.0.1/ORCL BUFFER=100000000 COMMIT=NO FULL=YES GRANTS=YES IGNORE=YES INDEXES=YES ROWS=YES SHOW=NO CONSTRAINTS=YES
    

      

  • 相关阅读:
    Java多线程
    2018腾讯校招软件开发岗在线笔试题
    2018京东校招Java笔试题
    计模式之中介者、观察者
    值得注意的Java基础知识
    Java的内部类
    用静态内部类实现单例模式
    String,StringBuilder区别,一个是常量,一个是可变量
    ArrayList list = new ArrayList()在这个泛型为Integer的ArrayList中存放一个String类型的对象
    List<String> list=new ArrayList<String>(20);为什么要声明为List 而不是ArrayList<String>?
  • 原文地址:https://www.cnblogs.com/hongwei2085/p/12609516.html
Copyright © 2011-2022 走看看