Professional Documents
Culture Documents
nternal SVRMGR>shutdown SVRMGR>quit oracle9i $ sqlplus /nolog SQL*Plus: Release 9.2.0.1.0 - Production on Fri Oct 31 13:53:53 2003 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. SQL> connect / as sysdba Connected to an idle instance. SQL> startup^C SQL> startup ORACLE instance started.
Oracle
6startup force
startup force
8startup EXCLUSIVE ORACLE , , sys ORACLE dictionary dict dict_column SQL : SQL>select * from dictionary where instr(comments,'index')>0; user_indexes SQL : SQL>select column_name,comments from dict_columns where table_name='USER_INDE XES'; ORACLE ORACLE 1 SQL>select username,default_tablespace from user_users;
SQL>select * from user_role_privs; SQL>select * from user_sys_privs; SQL>select * from user_tab_privs; 2 SQL>select * from user_tables; log SQL>select object_name,object_id from user_objects where instr(object_name,'LOG')>0; SQL>select object_name,created from user_objects where object_name=upper('&ta ble_name'); SQL>select sum(bytes)/(1024*1024) as "size(M)" from user_segments where segment_name=upper('&table_name'); ORACLE SQL>select table_name,cache from user_tables where instr(cache,'Y')>0; 3 SQL>select index_name,index_type,table_name from user_indexes order by table_n ame; SQL>select * from user_ind_columns where index_name=upper('&index_name'); SQL>select sum(bytes)/(1024*1024) as "size(M)" from user_segments where segment_name=upper('&index_name'); 4 last_number
SQL>select * from user_sequences; 5 SQL>select view_name from user_views; select SQL>set view_name,text_length from user_views; SQL>set long 2000; text_length set long SQL>select text from user_views where view_name=upper('&view_name'); 6 SQL>select * from user_synonyms; 7 SQL>select constraint_name, constraint_type,search_condition, r_constraint_name from user_constraints where table_name = upper('&table_name'); SQL>select c.constraint_name,c.constraint_type,cc.column_name from user_constraints c,user_cons_columns cc where c.owner = upper('&table_owner') and c.table_name = upper('&table_name') and c.owner = cc.owner and c.constraint_name = cc.constraint_name order by cc.position; 8 SQL>select object_name,status from user_objects where object_type='FUNCTION'; SQL>select object_name,status from user_objects where object_type='PROCEDURE' ; SQL>select text from all_source where owner=user and name=upper('&plsql_name ');
SQL 1
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size from dba_tablespaces t, dba_data_files d where t.tablespace_name = d.tablespace_name group by t.tablespace_name; 2 select tablespace_name, file_id, file_name, round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name; 3 select segment_name, tablespace_name, r.status, (initial_extent/1024) InitialExtent,(next_extent/1024) NextExtent, max_extents, v.curext CurExtent From dba_rollback_segs r, v$rollstat v Where r.segment_id = v.usn(+) order by segment_name ; 4 select name from v$controlfile; 5 select member from v$logfile; 6 select sum(bytes)/(1024*1024) as free_space,tablespace_name from dba_free_space group by tablespace_name; SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE, (B.BYTES*100)/A.BYTES "% USED",(C.BYTES*100)/A.BYTES "% FREE" FROM SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLE SPACE_NAME; 7
select owner, object_type, status, count(*) count# from all_objects group by owner, obje ct_type, status; 8 Select version FROM Product_component_version Where SUBSTR(PRODUCT,1,6)='Oracle'; 9 Select Created, Log_Mode, Log_Mode From V$Database; ORACLE SQL> select username,sid,serial# from v$session; SQL> alter system kill session 'sid,serial#'; , UNIX SQL> select pro.spid from v$session ses,v$process pro where ses.sid=21 and ses.paddr=p ro.addr; 21 sid kill
SQL*PLUS a SQL*Plus $sqlplus / SQL*Plus SQL>exit b sqlplus SQL SQL*Plus SQL>help SQL>help
c DESCRIBE SQL>DESC dSQL*Plus SQL SQL>L SQL SQL>n CHANGE SQL>c// SQL>L INPUT SQL SQL>i SQL> e SQL>edit DEFINE EDITOR login.sql DEFINE_EDITOR=vi f SQL>START test SQL>@test SQL*Plus a create table ALTER TABLE ADD test Age sql>alter table test add Age number(3) ALTER TABLE MODIFY
test Count 10 sql>alter atble test modify County char(10) b DORP TABLE sql>drop table test c
ORACLE SH SH exp_comp.sh rq=` date +"%m%d" ` su - oracle -c "exp system/manager full=y inctype=complete file=/oracle/export/db_comp$ rq.dmp" SH exp_cumu.sh rq=` date +"%m%d" ` su - oracle -c "exp system/manager full=y inctype=cumulative file=/oracle/export/db_cumu $rq.dmp" SH : exp_incr.sh rq=` date +"%m%d" ` su - oracle -c "exp system/manager full=y inctype=incremental file=/oracle/export/db_incr $rq.dmp" root crontab /var/spool/cron/crontabs/root 0 2 1 * * /oracle/exp_comp.sh 30 2 * * 0-5 /oracle/exp_incr.sh 45 2 * * 6 /oracle/exp_cumu.sh
ORACLE SQL . (DML) 1.INSERT () INSERT INTO ( 1, 2, ) VALUES ( 1, 2, ); INSERT INTO ( 1, 2, ) SELECT ( 1, 2, ) FROM ; , : GOOD DAY , ''. , . SYSDATE, TO_DATE(2001-08-01,YYYY-MM-DD) TO_DATE(), ORACLE DOC. -- :: YYYY-MM-DD HH24:MI:SS INSERT 4000 , , CLOB , ORACLE DBMS_LOB . INSERT 1 , CREATE SEQUENCE (+) INCREMENT BY 1 START WITH 1 MAXVALUE 99999 CYCLE NOCACHE; , NUMBER(6) , 999999 INSERT : .NEXTVAL 2.DELETE () DELETE FROM WHERE ; ORACLE . unused. , TRUNCATE , TRUNCATE TABLE ; . 3.UPDATE ()
UPDATE SET 1= 1, 2= 2, WHERE ; N , NULL, ; N , .. : A. SQL , , COMMIT , . , ROLLBACK . B. INSERT, DELETE UPDATE , () ,. ORACLE . . , SQL , COMMIT . . (DDL) 1.CREATE (, , , , , , ) ORACLE CHAR VARCHAR2 NUMBER(M,N) DATE M , N
, , , DEFAULT SYSDATE , UNIQUE, PRIMARY KEY 2.ALTER ALTER TABLE 1 TO 2; ALTER TABLE ADD ; (, , )
ALTER TABLE MODIFY ; ALTER TABLE ADD CONSTRAINT PRIMARY KEY (); ALTER TABLE ADD CONSTRAINT UNIQUE (); ALTER TABLE CACHE; ALTER TABLE NOCACHE; 3.DROP (, , , , , , )
DROP TABLE CASCADE CONSTRAINTS; 4.TRUNCATE (, ) TRUNCATE ; . (SELECT) SELECT 1, 2, FROM 1, [ 2, ] WHERE ; : COUNT(*), MIN(), MAX(), AVG(), DISTINCT(), TO_CHAR(DATE ,'YYYY-MM-DD HH24:MI:SS') NVL(EXPR1, EXPR2) : IF EXPR1=NULL RETURN EXPR2 ELSE RETURN EXPR1 DECODE(AAV1R1V2R2....) : IF AA=V1 THEN RETURN R1 IF AA=V2 THEN RETURN R2 .. ELSE RETURN NULL
LPAD(char1,n,char2) : char1 n char2 : ( 1* 1)/3 : SELECT FROM (SELECT FROM 1, [ 2, ] WHERE ) WHERE 2; : UNION(), UNION ALL(), MINUS, INTERSECT SELECT 1, 2, FROM 1, [ 2, ] GROUP BY 1 [HAVING ] ; SELECT 1, 2, FROM 1, [ 2, ] WHERE 1. = 2. [ AND ] ; SELECT 1, 2, FROM 1, [ 2, ] WHERE 1. = 2. (+) [ AND ] ; (+) , ASC, DESC SELECT 1, 2, FROM 1, [ 2, ] ORDER BY 1, 2 DESC; INSTR(, )>0 LIKE % [%%] ROWID, . .ORACLE (SCHEMA) 1. (INDEX)
CREATE INDEX ON ( 1, [ 2, ] ); ALTER INDEX REBUILD; (), , SQL , ORACLE8.1.7 1578 ORACLE8.0.6 758 2. (VIEW) CREATE VIEW AS SELECT . FROM ..; ALTER VIEW COMPILE; SQL , . 3. (SYNONMY) CREATE SYNONYM FOR ; CREATE SYNONYM FOR @; 4. (DATABASE LINK) CREATE DATABASE LINK CONNECT TO IDENTIFIED BY USING ; NET8 EASY CONFIG TNSNAMES.ORA . global_name=true SELECT * FROM GLOBAL_NAME; SELECT FROM @; . (DCL) 1.GRANT
GRANT CONNECT, RESOURCE TO ; GRANT SELECT ON TO ; GRANT SELECT, INSERT, DELETE ON TO 1, 2; 2.REVOKE REVOKE CONNECT, RESOURCE FROM ; REVOKE SELECT ON FROM ; REVOKE SELECT, INSERT, DELETE ON FROM 1, 2;
63 select orgaddr,destaddr from sm_histable0116 where error_code='63'; select MSISDN,TCOS,OCOS from ms_usertable
select error_code,count(*) from sm_histable0513 group by error_code order by error_code; select sum(Successcount) from tbl_MiddleMt0411 where ServiceType2=111 select sum(successcount),servicetype from tbl_middlemt0411 group by servicetype
http://www.cnoug.org/viewthread.php?tid=60293 // alter database backup controlfile to trace; // connect internal as sysdba alter database add logfile group 4 (/db01/oracle/CC1/log_1c.dbf, /db02/oracle/CC1/log_2c.dbf) size 5M; alter database add logfile member /db03/oracle/CC1/log_3c.dbf to group 4; // Server Manager MOUNT : connect internal as sysdba
startup mount ORA1 exclusive; alter database open; // @catalog @catproc // init.ora log_archive_dest_1 = /db00/arch log_archive_dest_state_1 = enable log_archive_dest_2 = "service=stby.world mandatory reopen=60" log_archive_dest_state_2 = enable // create user USERNAME identified by PASSWORD default tablespace TABLESPACE_NAME; alter user USERNAME default tablespace TABLESPACE_NAME; alter user SYSTEM quota 0 on SYSTEM; alter user SYSTEM quota 50M on TOOLS; create user USERNAME identified by PASSWORD default tablespace DATA temporary tablespace TEMP; alter user USERNAME temporary tablespace TEMP; // : alter database datafile /db05/oracle/CC1/data01.dbf resize 200M; //: create tablespace DATA datafile /db05/oracle/CC1/data01.dbf size 200M autoextend ON next 10M maxsize 250M; //: alter tablespace DATA add datafile /db05/oracle/CC1/data02.dbf size 50M autoextend ON maxsize 300M; //: alter database datafile /db05/oracle/CC1/data01.dbf
autoextend ON maxsize 300M; //: alter database rename file /db01/oracle/CC1/data01.dbf to /db02/oracle/CC1/data01.dbf; alter tablespace DATA rename datafile /db01/oracle/CC1/data01.dbf to /db02/oracle/CC1/data01.dbf; alter database rename file /db05/oracle/CC1/redo01CC1.dbf to /db02/oracle/CC1/redo01CC1.dbf; alter database datafile /db05/oracle/CC1/data01.dbf resize 80M; //: create role APPLICATION_USER; grant CREATE SESSION to APPLICATION_USER; grant APPLICATION_USER to username; // create rollback segment SEGMENT_NAME tablespace RBS; alter rollback segment SEGMENT_NAME offline; drop rollback segment SEGMENT_NAME; alter rollback segment SEGMENT_NAME online; // commit; set transaction use rollback segment ROLL_BATCH; insert into TABLE_NAME select * from DATA_LOAD_TABLE; commit; // select * from DBA_SEGMENTS where Segment_Type = ROLLBACK; select N.Name, /* rollback segment name */
S.OptSize
from V$ROLLNAME N, V$ROLLSTAT S where N.USN=S.USN; // alter rollback segment R1 shrink to 15M; alter rollback segment R1 shrink; // 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 R4 online; select Sessions_Highwater from V$LICENSE; grant select on EMPLOYEE to PUBLIC; // create role ACCOUNT_CREATOR; grant CREATE SESSION, CREATE USER, ALTER USER to ACCOUNT_CREATOR; alter user THUMPER default role NONE; alter user THUMPER default role CONNECT; alter user THUMPER default role all except ACCOUNT_CREATOR; alter profile DEFAULT limit idle_time 60; create profile LIMITED_PROFILE limit FAILED_LOGIN_ATTEMPTS 5; create user JANE identified by EYRE profile LIMITED_PROFILE; grant CREATE SESSION to JANE; alter user JANE account unlock; alter user JANE account lock; alter profile LIMITED_PROFILE limit
PASSWORD_LIFE_TIME 30; alter user jane password expire; // REM Creating OPS$ accounts create user OPS$FARMER identified by SOME_PASSWORD default tablespace USERS temporary tablespace TEMP; REM Using identified externally create user OPS$FARMER identified externally default tablespace USERS temporary tablespace TEMP; // ORAPWD ORAPWD FILE=filename PASSWORD=password ENTRIES=max_users create role APPLICATION_USER; grant CREATE SESSION to APPLICATION_USER; create role DATA_ENTRY_CLERK; grant select, insert on THUMPER.EMPLOYEE to DATA_ENTRY_CLERK; grant select, insert on THUMPER.TIME_CARDS to DATA_ENTRY_CLERK; grant select, insert on THUMPER.DEPARTMENT to DATA_ENTRY_CLERK; grant APPLICATION_USER to DATA_ENTRY_CLERK; grant DATA_ENTRY_CLERK to MCGREGOR; grant DATA_ENTRY_CLERK to BPOTTER with admin option; // set role DATA_ENTRY_CLERK; set role NONE; //: revoke delete on EMPLOYEE from PETER; revoke all on EMPLOYEE from MCGREGOR; //: revoke ACCOUNT_CREATOR from HELPDESK; drop user USERNAME cascade; grant SELECT on EMPLOYEE to MCGREGOR with grant option;
grant SELECT on THUMPER.EMPLOYEE to BPOTTER with grant option; revoke SELECT on EMPLOYEE from MCGREGOR; create user MCGREGOR identified by VALUES 1A2DD3CCEE354DFA; alter user OPS$FARMER identified by VALUES no way; // export exp system/manager file=expdat.dmp compress=Y owner=(HR,THUMPER) exp system/manager file=hr.dmp owner=HR indexes=Y compress=Y imp system/manager file=hr.dmp full=Y buffer=64000 commit=Y // exp system/manager FILE=expdat.dmp TABLES=(Thumper.SALES) // exp system/manager FILE=expdat.dmp TABLES=(Thumper.SALES:Part1) // imp system/manager file=expdat.dmp imp system/manager file=expdat.dmp buffer=64000 commit=Y exp system/manager file=thumper.dat owner=thumper grants=N indexes=Y compress=Y rows=Y imp system/manager file=thumper.dat FROMUSER=thumper TOUSER=flower rows=Y indexes=Y imp system/manager file=expdat.dmp full=Y commit=Y buffer=64000 imp system/manager file=expdat.dmp ignore=N rows=N commit=Y buffer=64000 // REM TAR examples tar -cvf /dev/rmt/0hc /db0[1-9]/oracle/CC1 tar -rvf /dev/rmt/0hc /orasw/app/oracle/CC1/pfile/initcc1.ora tar -rvf /dev/rmt/0hc /db0[1-9]/oracle/CC1 /orasw/app/oracle/CC1/pfile/initcc1.ora // shell ORACLE_SID=cc1; export ORACLE_SID ORAENV_ASK=NO; export ORAENV_ASK . oraenv svrmgrl <<EOF1 connect internal as sysdba shutdown immediate; exit EOF1
insert backup commands like the "tar" commands here svrmgrl <<EOF2 connect internal as sysdba startup EOF2 // Server Manager archivelog mode: connect internal as sysdba startup mount cc1; alter database archivelog; archive log start; alter database open; // Server Manager archivelog mode: connect internal as sysdba startup mount cc1; alter database noarchivelog; alter database open; select Name, Value from V$PARAMETER where Name like log_archive%; // # # Sample Hot Backup Script for a UNIX File System database # # Set up environment variables: ORACLE_SID=cc1; export ORACLE_SID ORAENV_ASK=NO; export ORAENV_ASK . oraenv svrmgrl <<EOFarch1 connect internal as sysdba REM REM SYSTEM tablespace REM alter tablespace SYSTEM begin backup; !tar -cvf /dev/rmt/0hc /db01/oracle/CC1/sys01.dbf alter tablespace SYSTEM end backup; REM REM The SYSTEM tablespace has now been written to a REM tar saveset on the tape device /dev/rmt/0hc. The REM rest of the tars must use the "-rvf" clause to append
REM to that saveset. REM REM RBS tablespace REM alter tablespace RBS begin backup; !tar -rvf /dev/rmt/0hc /db02/oracle/CC1/rbs01.dbf alter tablespace RBS end backup; REM REM DATA tablespace REM For the purposes of this example, this tablespace REM will contain two files, data01.dbf and data02.dbf. REM The * wildcard will be used in the filename. REM alter tablespace DATA begin backup; !tar -rvf /dev/rmt/0hc /db03/oracle/CC1/data0*.dbf alter tablespace DATA end backup; REM REM INDEXES tablespace REM alter tablespace INDEXES begin backup; !tar -rvf /dev/rmt/0hc /db04/oracle/CC1/indexes01.dbf alter tablespace INDEXES end backup; REM REM TEMP tablespace REM alter tablespace TEMP begin backup; !tar -rvf /dev/rmt/0hc /db05/oracle/CC1/temp01.dbf alter tablespace TEMP end backup; REM REM Follow the same pattern to back up the rest REM of the tablespaces. REM REM REM Step 2. . archive log stop REM REM Exit Server Manager, using the indicator set earlier. exit 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`; export FILES # # Now go back into Server Manager and restart the # archiving process. Set an indicator (called EOFarch2 # in this example). # svrmgrl <<EOFarch2 connect internal archive log start; exit EOFarch2 # # Now back up the archived redo logs to the tape # device via the "tar" command, then delete them # from the destination device via the "rm" command. # You may choose to compress them instead. # tar -rvf /dev/rmt/0hc $FILES rm -f $FILES # # # svrmgrl <<EOFarch3 connect internal alter database backup controlfile to db01/oracle/CC1/CC1controlfile.bck; exit EOFarch3 # # . # tar -rvf /dev/rmt/0hc /db01/oracle/CC1/CC1controlfile.bck # # End of hot backup script. // set pagesize 0 feedback off select alter tablespace ||Tablespace_Name|| begin backup; from DBA_TABLESPACES where Status <> INVALID spool alter_begin.sql Step 3. .
/ spool off // set pagesize 0 feedback off select alter tablespace ||Tablespace_Name|| end backup; from DBA_TABLESPACES where Status <> INVALID spool alter_end.sql / spool off //. REM See text for alternatives. # # # # svrmgrl <<EOFarch1 connect internal as sysdba archive log stop; REM REM Exit Server Manager using the indicator set earlier. exit EOFarch1 # # # Step 2: Record which files are in the destination Do this by setting an environment variable that is # directory. # 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`; export FILES # # Step 3: Go back into Server Manager and restart the # archiving process. Set an indicator (called EOFarch2 # in this example). # svrmgrl <<EOFarch2 connect internal as sysdba archive log start; Step 1: Stop the archiving process. This will keep additional archived redo log files from being written to the destination directory during this process.
exit EOFarch2 # # Step 4. Back up the archived redo logs to the tape # device via the "tar" command, then delete them # from the destination device via the "rm" command. # tar -rvf /dev/rmt/0hc $FILES # # # rm -f $FILES # # End of archived redo log file backup script. Step 5. Delete those files from the destination directory.
REM REM REM Back up the RBS tablespace - to another disk (UNIX) REM alter tablespace RBS begin backup; !cp /db02/oracle/CC1/rbs01.dbf /db10/oracle/CC1/backups alter tablespace RBS end backup; REM REM shell # # Procedure for moving archived redo logs to another device # svrmgrl <<EOFarch2 connect internal as sysdba archive log stop; !mv /db01/oracle/arch/CC1 /db10/oracle/arch/CC1 archive log start; exit EOFarch2 # # end of archived redo log directory move. // alter database backup controlfile to trace; // connect internal as sysdba startup mount instance_name;
recover database until time 1999-08-07:14:40:00; // rman rcvcat rman/rman@<database_service_name> // (UNIX) RMAN> create catalog tablespace rcvcat; // (NT) RMAN> create catalog tablespace "RCVCAT"; // (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=HQ) (PORT=1521)) (CONNECT DATA= (SID=loc))) // listener.ora entry // listener.ora entry LISTENER = (ADDRESS_LIST = (ADDRESS= (PROTOCOL=IPC) (KEY= loc.world) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = loc) (ORACLE_HOME = /orasw/app/oracle/product/8.1.5.1) ) ) // tnsnames.ora LOC= (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP) (HOST = HQ) (PORT = 1521))
) (CONNECT_DATA = (SERVICE_NAME = loc) (INSTANCE_NAME = loc) ) ) //sql*net LOC =(DESCRIPTION= (ADDRESS= (COMMUNITY=TCP.HQ.COMPANY) (PROTOCOL=TCP) (HOST=HQ) (PORT=1521)) (CONNECT DATA= (SID=loc))) // // tnsnames.ora HQ =(DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=HQ) (PORT=1521)) (CONNECT DATA= (SID=loc))) // listener.ora LISTENER = (ADDRESS_LIST = (ADDRESS= (PROTOCOL=IPC) (KEY= loc) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = loc) (ORACLE_HOME = /orasw/app/oracle/product/8.1.5.1) ) ) // Oracle8I tnsnames.ora LOC=
(DESCRIPTION= (ADDRESS = (PROTOCOL = TCP) (HOST = HQ) (PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = loc) (INSTANCE_NAME = loc) ) ) // COPY copy from remote_username/remote_password@service_name to username/password@service_name [append|create|insert|replace] TABLE_NAME using subquery; REM COPY example set copycommit 1 set arraysize 1000 copy from HR/PUFFINSTUFF@loc create EMPLOYEE using select * from EMPLOYEE
// lsnrctl start lsnrctl start my_lsnr lsnrctl status lsnrctl status hq ps -ef | grep tnslsnr // lsnrctl set password lsnr_password stop // lsnrctl set password lsnr_password
services // NT listener net start Oracle<version_name>TNSListener net stop Oracle<version_name>TNSListener // tnsnames.ora fld1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = server1.fld.com)(PORT = 1521)) ) (CONNECT_DATA = (SID = fld1) ) ) // telnet host_name ping host_name /etc/hosts 130.110.238.109 nmhost 130.110.238.101 txhost 130.110.238.102 azhost arizona //oratab loc:/orasw/app/oracle/product/8.1.5.1:Y cc1:/orasw/app/oracle/product/8.1.5.1:N old:/orasw/app/oracle/product/8.1.5.0:Y // alter database backup controlfile to trace; // connect internal as sysdba alter database add logfile group 4 (/db01/oracle/CC1/log_1c.dbf, /db02/oracle/CC1/log_2c.dbf) size 5M; alter database add logfile member /db03/oracle/CC1/log_3c.dbf to group 4; // Server Manager MOUNT : connect internal as sysdba
startup mount ORA1 exclusive; alter database open; // @catalog @catproc // init.ora log_archive_dest_1 = /db00/arch log_archive_dest_state_1 = enable log_archive_dest_2 = "service=stby.world mandatory reopen=60" log_archive_dest_state_2 = enable // create user USERNAME identified by PASSWORD default tablespace TABLESPACE_NAME; alter user USERNAME default tablespace TABLESPACE_NAME; alter user SYSTEM quota 0 on SYSTEM; alter user SYSTEM quota 50M on TOOLS; create user USERNAME identified by PASSWORD default tablespace DATA temporary tablespace TEMP; alter user USERNAME temporary tablespace TEMP; // : alter database datafile /db05/oracle/CC1/data01.dbf resize 200M; //: create tablespace DATA datafile /db05/oracle/CC1/data01.dbf size 200M autoextend ON next 10M maxsize 250M; //: alter tablespace DATA add datafile /db05/oracle/CC1/data02.dbf size 50M autoextend ON maxsize 300M; //: alter database datafile /db05/oracle/CC1/data01.dbf
autoextend ON maxsize 300M; //: alter database rename file /db01/oracle/CC1/data01.dbf to /db02/oracle/CC1/data01.dbf; alter tablespace DATA rename datafile /db01/oracle/CC1/data01.dbf to /db02/oracle/CC1/data01.dbf; alter database rename file /db05/oracle/CC1/redo01CC1.dbf to /db02/oracle/CC1/redo01CC1.dbf; alter database datafile /db05/oracle/CC1/data01.dbf resize 80M; //: create role APPLICATION_USER; grant CREATE SESSION to APPLICATION_USER; grant APPLICATION_USER to username; // create rollback segment SEGMENT_NAME tablespace RBS; alter rollback segment SEGMENT_NAME offline; drop rollback segment SEGMENT_NAME; alter rollback segment SEGMENT_NAME online; // commit; set transaction use rollback segment ROLL_BATCH; insert into TABLE_NAME select * from DATA_LOAD_TABLE; commit; // select * from DBA_SEGMENTS where Segment_Type = ROLLBACK; select N.Name, /* rollback segment name */
S.OptSize
from V$ROLLNAME N, V$ROLLSTAT S where N.USN=S.USN; // alter rollback segment R1 shrink to 15M; alter rollback segment R1 shrink; // 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 R4 online; select Sessions_Highwater from V$LICENSE; grant select on EMPLOYEE to PUBLIC; // create role ACCOUNT_CREATOR; grant CREATE SESSION, CREATE USER, ALTER USER to ACCOUNT_CREATOR; alter user THUMPER default role NONE; alter user THUMPER default role CONNECT; alter user THUMPER default role all except ACCOUNT_CREATOR; alter profile DEFAULT limit idle_time 60; create profile LIMITED_PROFILE limit FAILED_LOGIN_ATTEMPTS 5; create user JANE identified by EYRE profile LIMITED_PROFILE; grant CREATE SESSION to JANE; alter user JANE account unlock; alter user JANE account lock; alter profile LIMITED_PROFILE limit
PASSWORD_LIFE_TIME 30; alter user jane password expire; // REM Creating OPS$ accounts create user OPS$FARMER identified by SOME_PASSWORD default tablespace USERS temporary tablespace TEMP; REM Using identified externally create user OPS$FARMER identified externally default tablespace USERS temporary tablespace TEMP; // ORAPWD ORAPWD FILE=filename PASSWORD=password ENTRIES=max_users create role APPLICATION_USER; grant CREATE SESSION to APPLICATION_USER; create role DATA_ENTRY_CLERK; grant select, insert on THUMPER.EMPLOYEE to DATA_ENTRY_CLERK; grant select, insert on THUMPER.TIME_CARDS to DATA_ENTRY_CLERK; grant select, insert on THUMPER.DEPARTMENT to DATA_ENTRY_CLERK; grant APPLICATION_USER to DATA_ENTRY_CLERK; grant DATA_ENTRY_CLERK to MCGREGOR; grant DATA_ENTRY_CLERK to BPOTTER with admin option; // set role DATA_ENTRY_CLERK; set role NONE; //: revoke delete on EMPLOYEE from PETER; revoke all on EMPLOYEE from MCGREGOR; //: revoke ACCOUNT_CREATOR from HELPDESK; drop user USERNAME cascade; grant SELECT on EMPLOYEE to MCGREGOR with grant option;
grant SELECT on THUMPER.EMPLOYEE to BPOTTER with grant option; revoke SELECT on EMPLOYEE from MCGREGOR; create user MCGREGOR identified by VALUES 1A2DD3CCEE354DFA; alter user OPS$FARMER identified by VALUES no way; // export exp system/manager file=expdat.dmp compress=Y owner=(HR,THUMPER) exp system/manager file=hr.dmp owner=HR indexes=Y compress=Y imp system/manager file=hr.dmp full=Y buffer=64000 commit=Y // exp system/manager FILE=expdat.dmp TABLES=(Thumper.SALES) // exp system/manager FILE=expdat.dmp TABLES=(Thumper.SALES:Part1) // imp system/manager file=expdat.dmp imp system/manager file=expdat.dmp buffer=64000 commit=Y exp system/manager file=thumper.dat owner=thumper grants=N indexes=Y compress=Y rows=Y imp system/manager file=thumper.dat FROMUSER=thumper TOUSER=flower rows=Y indexes=Y imp system/manager file=expdat.dmp full=Y commit=Y buffer=64000 imp system/manager file=expdat.dmp ignore=N rows=N commit=Y buffer=64000 // REM TAR examples tar -cvf /dev/rmt/0hc /db0[1-9]/oracle/CC1 tar -rvf /dev/rmt/0hc /orasw/app/oracle/CC1/pfile/initcc1.ora tar -rvf /dev/rmt/0hc /db0[1-9]/oracle/CC1 /orasw/app/oracle/CC1/pfile/initcc1.ora // shell ORACLE_SID=cc1; export ORACLE_SID ORAENV_ASK=NO; export ORAENV_ASK . oraenv svrmgrl <<EOF1 connect internal as sysdba shutdown immediate; exit EOF1
insert backup commands like the "tar" commands here svrmgrl <<EOF2 connect internal as sysdba startup EOF2 // Server Manager archivelog mode: connect internal as sysdba startup mount cc1; alter database archivelog; archive log start; alter database open; // Server Manager archivelog mode: connect internal as sysdba startup mount cc1; alter database noarchivelog; alter database open; select Name, Value from V$PARAMETER where Name like log_archive%; // # # Sample Hot Backup Script for a UNIX File System database # # Set up environment variables: ORACLE_SID=cc1; export ORACLE_SID ORAENV_ASK=NO; export ORAENV_ASK . oraenv svrmgrl <<EOFarch1 connect internal as sysdba REM REM SYSTEM tablespace REM alter tablespace SYSTEM begin backup; !tar -cvf /dev/rmt/0hc /db01/oracle/CC1/sys01.dbf alter tablespace SYSTEM end backup; REM REM The SYSTEM tablespace has now been written to a REM tar saveset on the tape device /dev/rmt/0hc. The REM rest of the tars must use the "-rvf" clause to append
REM to that saveset. REM REM RBS tablespace REM alter tablespace RBS begin backup; !tar -rvf /dev/rmt/0hc /db02/oracle/CC1/rbs01.dbf alter tablespace RBS end backup; REM REM DATA tablespace REM For the purposes of this example, this tablespace REM will contain two files, data01.dbf and data02.dbf. REM The * wildcard will be used in the filename. REM alter tablespace DATA begin backup; !tar -rvf /dev/rmt/0hc /db03/oracle/CC1/data0*.dbf alter tablespace DATA end backup; REM REM INDEXES tablespace REM alter tablespace INDEXES begin backup; !tar -rvf /dev/rmt/0hc /db04/oracle/CC1/indexes01.dbf alter tablespace INDEXES end backup; REM REM TEMP tablespace REM alter tablespace TEMP begin backup; !tar -rvf /dev/rmt/0hc /db05/oracle/CC1/temp01.dbf alter tablespace TEMP end backup; REM REM Follow the same pattern to back up the rest REM of the tablespaces. REM REM REM Step 2. . archive log stop REM REM Exit Server Manager, using the indicator set earlier. exit 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`; export FILES # # Now go back into Server Manager and restart the # archiving process. Set an indicator (called EOFarch2 # in this example). # svrmgrl <<EOFarch2 connect internal archive log start; exit EOFarch2 # # Now back up the archived redo logs to the tape # device via the "tar" command, then delete them # from the destination device via the "rm" command. # You may choose to compress them instead. # tar -rvf /dev/rmt/0hc $FILES rm -f $FILES # # # svrmgrl <<EOFarch3 connect internal alter database backup controlfile to db01/oracle/CC1/CC1controlfile.bck; exit EOFarch3 # # . # tar -rvf /dev/rmt/0hc /db01/oracle/CC1/CC1controlfile.bck # # End of hot backup script. // set pagesize 0 feedback off select alter tablespace ||Tablespace_Name|| begin backup; from DBA_TABLESPACES where Status <> INVALID spool alter_begin.sql Step 3. .
/ spool off // set pagesize 0 feedback off select alter tablespace ||Tablespace_Name|| end backup; from DBA_TABLESPACES where Status <> INVALID spool alter_end.sql / spool off //. REM See text for alternatives. # # # # svrmgrl <<EOFarch1 connect internal as sysdba archive log stop; REM REM Exit Server Manager using the indicator set earlier. exit EOFarch1 # # # Step 2: Record which files are in the destination Do this by setting an environment variable that is # directory. # 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`; export FILES # # Step 3: Go back into Server Manager and restart the # archiving process. Set an indicator (called EOFarch2 # in this example). # svrmgrl <<EOFarch2 connect internal as sysdba archive log start; Step 1: Stop the archiving process. This will keep additional archived redo log files from being written to the destination directory during this process.
exit EOFarch2 # # Step 4. Back up the archived redo logs to the tape # device via the "tar" command, then delete them # from the destination device via the "rm" command. # tar -rvf /dev/rmt/0hc $FILES # # # rm -f $FILES # # End of archived redo log file backup script. Step 5. Delete those files from the destination directory.
REM REM REM Back up the RBS tablespace - to another disk (UNIX) REM alter tablespace RBS begin backup; !cp /db02/oracle/CC1/rbs01.dbf /db10/oracle/CC1/backups alter tablespace RBS end backup; REM REM shell # # Procedure for moving archived redo logs to another device # svrmgrl <<EOFarch2 connect internal as sysdba archive log stop; !mv /db01/oracle/arch/CC1 /db10/oracle/arch/CC1 archive log start; exit EOFarch2 # # end of archived redo log directory move. // alter database backup controlfile to trace; // connect internal as sysdba startup mount instance_name;
recover database until time 1999-08-07:14:40:00; // rman rcvcat rman/rman@<database_service_name> // (UNIX) RMAN> create catalog tablespace rcvcat; // (NT) RMAN> create catalog tablespace "RCVCAT"; // (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=HQ) (PORT=1521)) (CONNECT DATA= (SID=loc))) // listener.ora entry
// alter database backup controlfile to trace; // connect internal as sysdba alter database add logfile group 4 (/db01/oracle/CC1/log_1c.dbf, /db02/oracle/CC1/log_2c.dbf) size 5M; alter database add logfile member /db03/oracle/CC1/log_3c.dbf to group 4; // Server Manager MOUNT : connect internal as sysdba startup mount ORA1 exclusive; alter database open; // @catalog @catproc
// init.ora log_archive_dest_1 = /db00/arch log_archive_dest_state_1 = enable log_archive_dest_2 = "service=stby.world mandatory reopen=60" log_archive_dest_state_2 = enable // create user USERNAME identified by PASSWORD default tablespace TABLESPACE_NAME; alter user USERNAME default tablespace TABLESPACE_NAME; alter user SYSTEM quota 0 on SYSTEM; alter user SYSTEM quota 50M on TOOLS; create user USERNAME identified by PASSWORD default tablespace DATA temporary tablespace TEMP; alter user USERNAME temporary tablespace TEMP; // : alter database datafile /db05/oracle/CC1/data01.dbf resize 200M; //: create tablespace DATA datafile /db05/oracle/CC1/data01.dbf size 200M autoextend ON next 10M maxsize 250M; //: alter tablespace DATA add datafile /db05/oracle/CC1/data02.dbf size 50M autoextend ON maxsize 300M; //: alter database datafile /db05/oracle/CC1/data01.dbf autoextend ON maxsize 300M; //: alter database rename file /db01/oracle/CC1/data01.dbf to
/db02/oracle/CC1/data01.dbf; alter tablespace DATA rename datafile /db01/oracle/CC1/data01.dbf to /db02/oracle/CC1/data01.dbf; alter database rename file /db05/oracle/CC1/redo01CC1.dbf to /db02/oracle/CC1/redo01CC1.dbf; alter database datafile /db05/oracle/CC1/data01.dbf resize 80M; //: create role APPLICATION_USER; grant CREATE SESSION to APPLICATION_USER; grant APPLICATION_USER to username; // create rollback segment SEGMENT_NAME tablespace RBS; alter rollback segment SEGMENT_NAME offline; drop rollback segment SEGMENT_NAME; alter rollback segment SEGMENT_NAME online; // commit; set transaction use rollback segment ROLL_BATCH; insert into TABLE_NAME select * from DATA_LOAD_TABLE; commit; // select * from DBA_SEGMENTS where Segment_Type = ROLLBACK; select N.Name, S.OptSize /* rollback segment name */ /* rollback segment OPTIMAL size */
from V$ROLLNAME N, V$ROLLSTAT S where N.USN=S.USN; // alter rollback segment R1 shrink to 15M; alter rollback segment R1 shrink;
// 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 R4 online; select Sessions_Highwater from V$LICENSE; grant select on EMPLOYEE to PUBLIC; // create role ACCOUNT_CREATOR; grant CREATE SESSION, CREATE USER, ALTER USER to ACCOUNT_CREATOR; alter user THUMPER default role NONE; alter user THUMPER default role CONNECT; alter user THUMPER default role all except ACCOUNT_CREATOR; alter profile DEFAULT limit idle_time 60; create profile LIMITED_PROFILE limit FAILED_LOGIN_ATTEMPTS 5; create user JANE identified by EYRE profile LIMITED_PROFILE; grant CREATE SESSION to JANE; alter user JANE account unlock; alter user JANE account lock; alter profile LIMITED_PROFILE limit PASSWORD_LIFE_TIME 30; alter user jane password expire; // REM Creating OPS$ accounts create user OPS$FARMER
identified by SOME_PASSWORD default tablespace USERS temporary tablespace TEMP; REM Using identified externally create user OPS$FARMER identified externally default tablespace USERS temporary tablespace TEMP; // ORAPWD ORAPWD FILE=filename PASSWORD=password ENTRIES=max_users create role APPLICATION_USER; grant CREATE SESSION to APPLICATION_USER; create role DATA_ENTRY_CLERK; grant select, insert on THUMPER.EMPLOYEE to DATA_ENTRY_CLERK; grant select, insert on THUMPER.TIME_CARDS to DATA_ENTRY_CLERK; grant select, insert on THUMPER.DEPARTMENT to DATA_ENTRY_CLERK; grant APPLICATION_USER to DATA_ENTRY_CLERK; grant DATA_ENTRY_CLERK to MCGREGOR; grant DATA_ENTRY_CLERK to BPOTTER with admin option; // set role DATA_ENTRY_CLERK; set role NONE; //: revoke delete on EMPLOYEE from PETER; revoke all on EMPLOYEE from MCGREGOR; //: revoke ACCOUNT_CREATOR from HELPDESK; drop user USERNAME cascade; grant SELECT on EMPLOYEE to MCGREGOR with grant option; grant SELECT on THUMPER.EMPLOYEE to BPOTTER with grant option; revoke SELECT on EMPLOYEE from MCGREGOR; create user MCGREGOR identified by VALUES 1A2DD3CCEE354DFA; alter user OPS$FARMER identified by VALUES no way;
// export exp system/manager file=expdat.dmp compress=Y owner=(HR,THUMPER) exp system/manager file=hr.dmp owner=HR indexes=Y compress=Y imp system/manager file=hr.dmp full=Y buffer=64000 commit=Y // exp system/manager FILE=expdat.dmp TABLES=(Thumper.SALES) // exp system/manager FILE=expdat.dmp TABLES=(Thumper.SALES:Part1) // imp system/manager file=expdat.dmp imp system/manager file=expdat.dmp buffer=64000 commit=Y exp system/manager file=thumper.dat owner=thumper grants=N indexes=Y compress=Y rows=Y imp system/manager file=thumper.dat FROMUSER=thumper TOUSER=flower rows=Y indexes=Y imp system/manager file=expdat.dmp full=Y commit=Y buffer=64000 imp system/manager file=expdat.dmp ignore=N rows=N commit=Y buffer=64000 // REM TAR examples tar -cvf /dev/rmt/0hc /db0[1-9]/oracle/CC1 tar -rvf /dev/rmt/0hc /orasw/app/oracle/CC1/pfile/initcc1.ora tar -rvf /dev/rmt/0hc /db0[1-9]/oracle/CC1 /orasw/app/oracle/CC1/pfile/initcc1.ora // shell ORACLE_SID=cc1; export ORACLE_SID ORAENV_ASK=NO; export ORAENV_ASK . oraenv svrmgrl <<EOF1 connect internal as sysdba shutdown immediate; exit EOF1 insert backup commands like the "tar" commands here svrmgrl <<EOF2 connect internal as sysdba startup EOF2
// Server Manager archivelog mode: connect internal as sysdba startup mount cc1; alter database archivelog; archive log start; alter database open; // Server Manager archivelog mode: connect internal as sysdba startup mount cc1; alter database noarchivelog; alter database open; select Name, Value from V$PARAMETER where Name like log_archive%; // # # Sample Hot Backup Script for a UNIX File System database # # Set up environment variables: ORACLE_SID=cc1; export ORACLE_SID ORAENV_ASK=NO; export ORAENV_ASK . oraenv svrmgrl <<EOFarch1 connect internal as sysdba REM REM SYSTEM tablespace REM alter tablespace SYSTEM begin backup; !tar -cvf /dev/rmt/0hc /db01/oracle/CC1/sys01.dbf alter tablespace SYSTEM end backup; REM REM The SYSTEM tablespace has now been written to a REM tar saveset on the tape device /dev/rmt/0hc. The REM rest of the tars must use the "-rvf" clause to append REM to that saveset. REM REM RBS tablespace REM alter tablespace RBS begin backup;
!tar -rvf /dev/rmt/0hc /db02/oracle/CC1/rbs01.dbf alter tablespace RBS end backup; REM REM DATA tablespace REM For the purposes of this example, this tablespace REM will contain two files, data01.dbf and data02.dbf. REM The * wildcard will be used in the filename. REM alter tablespace DATA begin backup; !tar -rvf /dev/rmt/0hc /db03/oracle/CC1/data0*.dbf alter tablespace DATA end backup; REM REM INDEXES tablespace REM alter tablespace INDEXES begin backup; !tar -rvf /dev/rmt/0hc /db04/oracle/CC1/indexes01.dbf alter tablespace INDEXES end backup; REM REM TEMP tablespace REM alter tablespace TEMP begin backup; !tar -rvf /dev/rmt/0hc /db05/oracle/CC1/temp01.dbf alter tablespace TEMP end backup; REM REM Follow the same pattern to back up the rest REM of the tablespaces. REM REM REM Step 2. . archive log stop REM REM Exit Server Manager, using the indicator set earlier. exit 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`; export FILES #
# Now go back into Server Manager and restart the # archiving process. Set an indicator (called EOFarch2 # in this example). # svrmgrl <<EOFarch2 connect internal archive log start; exit EOFarch2 # # Now back up the archived redo logs to the tape # device via the "tar" command, then delete them # from the destination device via the "rm" command. # You may choose to compress them instead. # tar -rvf /dev/rmt/0hc $FILES rm -f $FILES # # # svrmgrl <<EOFarch3 connect internal alter database backup controlfile to db01/oracle/CC1/CC1controlfile.bck; exit EOFarch3 # # . # tar -rvf /dev/rmt/0hc /db01/oracle/CC1/CC1controlfile.bck # # End of hot backup script. // set pagesize 0 feedback off select alter tablespace ||Tablespace_Name|| begin backup; from DBA_TABLESPACES where Status <> INVALID spool alter_begin.sql / spool off // set pagesize 0 feedback off Step 3. .
select alter tablespace ||Tablespace_Name|| end backup; from DBA_TABLESPACES where Status <> INVALID spool alter_end.sql / spool off //. REM See text for alternatives. # # # # svrmgrl <<EOFarch1 connect internal as sysdba archive log stop; REM REM Exit Server Manager using the indicator set earlier. exit EOFarch1 # # # Step 2: Record which files are in the destination Do this by setting an environment variable that is # directory. # 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`; export FILES # # Step 3: Go back into Server Manager and restart the # archiving process. Set an indicator (called EOFarch2 # in this example). # svrmgrl <<EOFarch2 connect internal as sysdba archive log start; exit EOFarch2 # # Step 4. Back up the archived redo logs to the tape # device via the "tar" command, then delete them Step 1: Stop the archiving process. This will keep additional archived redo log files from being written to the destination directory during this process.
# from the destination device via the "rm" command. # tar -rvf /dev/rmt/0hc $FILES # # # rm -f $FILES # # End of archived redo log file backup script. Step 5. Delete those files from the destination directory.
REM REM REM Back up the RBS tablespace - to another disk (UNIX) REM alter tablespace RBS begin backup; !cp /db02/oracle/CC1/rbs01.dbf /db10/oracle/CC1/backups alter tablespace RBS end backup; REM REM shell # # Procedure for moving archived redo logs to another device # svrmgrl <<EOFarch2 connect internal as sysdba archive log stop; !mv /db01/oracle/arch/CC1 /db10/oracle/arch/CC1 archive log start; exit EOFarch2 # # end of archived redo log directory move. // alter database backup controlfile to trace; // connect internal as sysdba startup mount instance_name; recover database until time 1999-08-07:14:40:00; // rman rcvcat rman/rman@<database_service_name>
// (UNIX) RMAN> create catalog tablespace rcvcat; // (NT) RMAN> create catalog tablespace "RCVCAT"; // (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=HQ) (PORT=1521)) (CONNECT DATA= (SID=loc))) // listener.ora entry LISTENER = (ADDRESS_LIST = (ADDRESS= (PROTOCOL=IPC) http:// (KEY= loc.world) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = loc) (ORACLE_HOME = /orasw/app/oracle/product/8.1.5.1) ) ) // tnsnames.ora LOC= (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP) (HOST = HQ) (PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = loc) (INSTANCE_NAME = loc)
) ) //sql*net LOC =(DESCRIPTION= (ADDRESS= (COMMUNITY=TCP.HQ.COMPANY) (PROTOCOL=TCP) (HOST=HQ) (PORT=1521)) (CONNECT DATA= (SID=loc))) // // tnsnames.ora HQ =(DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=HQ) (PORT=1521)) (CONNECT DATA= (SID=loc))) // listener.ora LISTENER = (ADDRESS_LIST = (ADDRESS= (PROTOCOL=IPC) (KEY= loc) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = loc) (ORACLE_HOME = /orasw/app/oracle/product/8.1.5.1) ) ) // Oracle8I tnsnames.ora LOC= (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP) (HOST = HQ)
(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = loc) (INSTANCE_NAME = loc) ) ) // COPY copy from remote_username/remote_password@service_name to username/password@service_name [append|create|insert|replace] TABLE_NAME using subquery; REM COPY example set copycommit 1 set arraysize 1000 copy from HR/PUFFINSTUFF@loc create EMPLOYEE using select * from EMPLOYEE
// lsnrctl start lsnrctl start my_lsnr lsnrctl status lsnrctl status hq ps -ef | grep tnslsnr // lsnrctl set password lsnr_password stop // lsnrctl set password lsnr_password services // NT listener net start Oracle<version_name>TNSListener net stop Oracle<version_name>TNSListener
// tnsnames.ora fld1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = server1.fld.com)(PORT = 1521)) ) (CONNECT_DATA = (SID = fld1) ) ) // telnet host_name ping host_name /etc/hosts 130.110.238.109 nmhost 130.110.238.101 txhost 130.110.238.102 azhost arizona //oratab loc:/orasw/app/oracle/product/8.1.5.1:Y cc1:/orasw/app/oracle/product/8.1.5.1:N old:/orasw/app/oracle/product/8.1.5.0:Y