oracle常用命令大汇总(五)

第十二章: backup and recovery

    1. v$sga,v$instance,v$process,v$bgprocess,v$database,v$datafile,v$sgastat

    2. rman need set dbwr_io_slaves or backup_tape_io_slaves and large_pool_size

    3. monitoring parallel rollback

    > v$fast_start_servers , v$fast_start_transactions

    4.perform a closed database backup (noarchivelog)

    > shutdown immediate

    > cp files /backup/

    > startup

    5.restore to a different location

    > connect system/manager as sysdba

    > startup mount

    > alter database rename file ''/disk1/../user.dbf''to ''/disk2/../user.dbf'';

    > alter database open;

    6.recover syntax

    --recover a mounted database

    >recover database;

    >recover datafile ''/disk1/data/df2.dbf'';

    >alter database recover database;

    --recover an opened database

    >recover tablespace user_data;

    >recover datafile 2;

    >alter database recover datafile 2;

    7.how to apply redo log files automatically

    >set autorecovery on

    >recover automatic datafile 4;

    8.complete recovery:

    --method 1(mounted databae)

    >copy c:\backup\user.dbf c:\oradata\user.dbf

    >startup mount

    >recover datafile ''c:\oradata\user.dbf;

    >alter database open;

    --method 2(opened database,initially opened,not system or rollback datafile)


    >copy c:\backup\user.dbf c:\oradata\user.dbf (alter tablespace offline)

    >recover datafile ''c:\oradata\user.dbf'' or

    >recover tablespace user_data;

    >alter database datafile ''c:\oradata\user.dbf'' online or

    >alter tablespace user_data online;

    --method 3(opened database,initially closed not system or rollback datafile)

    >startup mount

    >alter database datafile ''c:\oradata\user.dbf'' offline;

    >alter database open

    >copy c:\backup\user.dbf d:\oradata\user.dbf

    >alter database rename file ''c:\oradata\user.dbf''to ''d:\oradata\user.dbf''

    >recover datafile ''e:\oradata\user.dbf'' or recover tablespace user_data;

    >alter tablespace user_data online;

    --method 4(loss of data file with no backup and have all archive log)

    >alter tablespace user_data offline immediate;

    >alter database create datafile ''d:\oradata\user.dbf''as ''c:\oradata\user.dbf''''

    >recover tablespace user_data;

    >alter tablespace user_data online

    5.perform an open database backup

    > alter tablespace user_data begin backup;

    > copy files /backup/

    > alter database datafile ''/c:/../data.dbf'' end backup;

    > alter system switch logfile;

    6.backup a control file

    > alter database backup controlfile to ''control1.bkp'';

    > alter database backup controlfile to trace;

    7.recovery (noarchivelog mode)

    > shutdown abort

    > cp files

    > startup

    8.recovery of file in backup mode

    >alter database datafile 2 end backup;

    9.clearing redo log file

    >alter database clear unarchived logfile group 1;

    >alter database clear unarchived logfile group 1 unrecoverable datafile;

    10.redo log recovery

    >alter database add logfile group 3 ''c:\oradata\redo03.log''size 1000k;

    >alter database drop logfile group 1;

    >alter database open;

    or >cp c:\oradata\redo02.log'' c:\oradata\redo01.log

    >alter database clear logfile ''c:\oradata\log01.log'';

你可能感兴趣的:(oracle,C++,c,C#)