【正文】
rom the destination device via the “rm” mand. tarrvf /dev/rmt/0hc $FILES Step those files from the destination directory. rmf $FILES End of archived redo log file backup 磁盤到磁盤的備份 REM REM Back up the RBS tablespacecreate EMPLOYEEselect * from EMPLOYEE//監(jiān)視器的管理 lsnrctl start lsnrctl start my_lsnr lsnrctl status lsnrctl status hq 檢查監(jiān)視器的進(jìn)程psef | grep tnslsnr //在 lsnrctl 內(nèi)停止監(jiān)視器 set password lsnr_password stop //在lsnrctl 內(nèi)列出所有的服務(wù) set password lsnr_password services //啟動或停止一個(gè)NT的listener net start OracleTNSListener net stop OracleTNSListener // 文件的內(nèi)容 fld1 =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = )(PORT = 1521)))(CONNECT_DATA =(SID = fld1)))//操作系統(tǒng)網(wǎng)絡(luò)的管理 telnet host_name ping host_name /etc/hosts 文件 nmhost txhost azhost arizona //oratab 表項(xiàng)loc:/orasw/app/oracle/product/:Y cc1:/orasw/app/oracle/product/:N old:/orasw/app/oracle/product/:Y //創(chuàng)建一個(gè)控制文件命令到跟蹤文件alter database backup controlfile to trace。REM REM Exit Server Manager using the indicator set EOFarch1 Step 2: Record which files are in the destination directory. Do this by setting an environment variable that is equal to the directory listing for the destination directory. For this example, the log_archive_dest is /db01/oracle/arch/CC1. FILES=`ls /db01/oracle/arch/CC1/arch*.dbf`。’ from DBA_TABLESPACES where Status ’INVALID’ spool / spool off //自動生成備份結(jié)束的腳本set pagesize 0 feedback off select ’alter tablespace ’||Tablespace_Name||’ end backup。exit EOFarch2 Now back up the archived redo logs to the tape device via the “tar” mand, then delete them from the destination device via the “rm” mand. You may choose to press them instead. tarrvf /dev/rmt/0hc $FILES rmf $FILES Step . svrmgrl connect internal alter database backup controlfile to ’db01/oracle/CC1/’。REM REM Follow the same pattern to back up the restREM of the REM REM Step log stop REM REM Exit Server Manager, using the indicator set EOFarch1 Record which files are in the destination directory. Do this by setting an environment variable that is equal to the directory listing for the destination directory. For this example, the log_archive_dest is /db01/oracle/arch/CC1. FILES=`ls /db01/oracle/arch/CC1/arch*.dbf`。REM REM 備份 TEMP tablespace REM alter tablespace TEMP begin backup。REM REM 備份 INDEXES tablespace REM alter tablespace INDEXES begin backup。REM REM 備份 DATA tablespace REM For the purposes of this example, this tablespace REM will contain two files, and The * wildcard will be used in the alter tablespace DATA begin backup。REM REM The SYSTEM tablespace has now been written to a REM tar saveset on the tape device /dev/rmt/ REM rest of the tars must use the “rvf” clause to append REM to that REM 備份 RBS tablespace REM alter tablespace RBS begin backup。export svrmgrl connect internal as sysdba REM REM 備份 SYSTEM tablespace REM alter tablespace SYSTEM begin backup。//聯(lián)機(jī)備份的腳本 Sample Hot Backup Script for a UNIX File System database Set up environment variables: ORACLE_SID=cc1。alter database open。//在Server Manager上設(shè)置為archivelog mode: connect internal as sysdba startup mount cc1。 scope=spfile。alter system set log_archive_format=39。archive log list alter system set LOG_ARCHIVE_DEST_1=39。archive log start。exit EOF1 insert backup mands like the “tar” mands here svrmgrl connect internal as sysdba startup EOF2 //在Server Manager上設(shè)置為archivelog mode: connect internal as sysdba startup mount cc1。export ORACLE_SID ORAENV_ASK=NO。00%39。00%39。alter user OPS$FARMER identified by VALUES ’no way’。revoke SELECT on EMPLOYEE from MCGREGOR。grant SELECT on EMPLOYEE to MCGREGOR with grant option。//回收角色: revoke ACCOUNT_CREATOR from HELPDESK。//回收權(quán)利: revoke delete on EMPLOYEE from PETER。//設(shè)置角色set role DATA_ENTRY_CLERK。grant DATA_ENTRY_CLERK to MCGREGOR。grant select, insert on to DATA_ENTRY_CLERK。grant select, insert on to DATA_ENTRY_CLERK。grant CREATE SESSION to APPLICATION_USER。REM Using identified externally create user OPS$FARMER identified externally default tablespace USERS temporary tablespace TEMP。alter user jane password expire。alter user JANE account lock。grant CREATE SESSION to JANE。create profile LIMITED_PROFILE limit FAILED_LOGIN_ATTEMPTS 5。alter user THUMPER default role all except ACCOUNT_CREATOR。alter user THUMPER default role NONE。//用戶和角色create role ACCOUNT_CREATOR。select Sessions_Highwater from V$LICENSE。//例子set transaction use rollback segment SEGMENT_NAME alter tablespace RBS default storage(initial 125K next 125K minextents 18 maxextents 249)create rollback segment R4 tablespace RBS storage(optimal 2250K)。//回收回滾段alter rollback segment R1 shrink to 15M。//查詢回滾段的 大小和優(yōu)化參數(shù) select * from DBA_SEGMENTS where Segment_Type = ’ROLLBACK’。insert into TABLE_NAME select * from DATA_LOAD_TABLE。//回滾段上指定事務(wù) mit。drop rollback segment SEGMENT_NAME。//回滾段的管理create rollback segment SEGMENT_NAME tablespace RBS。grant CREATE SESSION to APPLICATION_USER。alter database datafile ’/db05/oracle/CC1/’ resize 80M。alter tablespace DATA rename datafile ’/db01/oracle/CC1/’ to ’/db02/oracle/CC1/’。//修改參數(shù): alter database datafile ’/db05/oracle/CC1/’ autoextend ON maxsize 300M。//創(chuàng)建一個(gè)自動擴(kuò)展的數(shù)據(jù)文件: create tablespace DATA datafile ’/db05/oracle/CC1/’ size 200M autoextend ON next 10M maxsize 250M。alter user USERNAME temporary tablespace TEMP。alter user SYSTEM quota 50M on TOOLS。alter user USERNAME default tablespace TABLESPACE_NAME。alter database open。alter database add logfile member ’/db03/oracle/CC1