wORACLE8 obNAbvJo[x


Chapter2
p.25
SVRMGR> show parameters

NAME                                TYPE    VALUE
----------------------------------- ------- -----------
O7_DICTIONARY_ACCESSIBILITY         boolean TRUE
allow_partial_sn_results            boolean FALSE
always_anti_join                    string  NESTED_LOOPS
aq_tm_processes                     integer 0
arch_io_slaves                      integer 0
audit_trail                         string  NONE
b_tree_bitmap_plans                 boolean FALSE
background_dump_dest                string  %RDBMS80\%trace


p.27
SQL> ALTER SESSION SET SQL_TRACE = TRUE;


D:\ORANT\RDBMS80\TRACE> TKPROF80 ORA00483.TRC emp.lst


p.27-28
TKPROF: Release 8.0.3.0.0 - Production on Wed Oct 1 9:19:18 1997
(c) Copyright 1997 Oracle Corporation.  All rights reserved.
Trace file: ora00483.trc
Sort options: default
********************************************************************************
count    = number of times OCI procedure was executed
cpu      = cpu time in seconds executing
elapsed  = elapsed time in seconds executing
disk     = number of physical reads of buffers from disk
query    = number of buffers gotten for consistent read
current  = number of buffers gotten in current mode (usually for update)
rows     = number of rows processed by the fetch or execute call
********************************************************************************
alter session set sql_trace=true
Parsing user id: 20
select * from  emp
call     count     cpu   elapsed     disk    query  current      rows
------- ------  ------ --------- -------- -------- --------  --------
Parse        1    0.00      0.00        0        0        0         0
Execute      1    0.00      0.00        0        0        0         0
Fetch        2    0.00      0.00        2        2        3        13
------- ------  ------ --------- -------- -------- --------  --------
total        4    0.00      0.00        2        2        3        13
Misses in library cache during parse: 0
Optimizer goal: CHOOSE
Parsing user id: 20
1  session in tracefile.
       4  user  SQL statements in trace file.
       0  internal SQL statements in trace file.
       4  SQL statements in trace file.
       4  unique SQL statements in trace file.
      55  lines in trace file.


p.29
Oracle Server Manager Release 3.0.3.0.0 - Production
(c) Copyright 1997, Oracle Corporation.  All Rights Reserved.
Oracle8 Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
SVRMGR> connect internal
Password:
Connected.
SVRMGR> startup
ORACLE instance started.
Total System Global Area      12071016 bytes*6
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
Database opened.


p.30
SVRMGR> show sga
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
SVRMGR>


p.36
SVRMGR> startup open
ORACLE instance started.
Total System Global Area      12071016 bytes*9
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
Database opened.
SVRMGR>


p.37
SVRMGR> startup nomount
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
SVRMGR> startup mount
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.


p.41
SVRMGR> CREATE TABLESPACE tablespace_name DATAFILE 'datafile_name' SIZE 50M ONLINE;


p.42
SVRMGR> ALTER TABLESPACE tablespace_name
ADD DATAFILE 'datafile_name' SIZE 20M;


SVRMGR> ALTER TABLESPACE tablespace_name
RENAME DATAFILE 'old_filename' TO 'new_filename';

SVRMGR> ALTER DATABASE RENAME FILE 'old_filename' TO 'new_filename';


p.43
SVRMGR> ALTER TABLESPACE prod_tables OFFLINE NORMAL;


p.44
SVRMGR> ALTER DATABASE DATAFILE 'd:\orant\database\usr2.ora' OFFLINE;
SVRMGR> ALTER DATABASE DATAFILE 'd:\orant\database\usr2.ora' OFFLINE DROP;


p.46-47
PROMPT General Setup
set echo on
drop table abc;
set echo off
set feedback on
set lines 80
set pause off
col partition_name format a10
col index_name format a12
col tablespace_name format a16
col table_name format a10
col high_value format a10
set echo off
PAUSE Create a partition table with partitions p1 in the
PAUSE user's default tablespace and partition p2 in the temporary
PAUSE tablespace
set echo on
create table abc(a number, b varchar2(10))
partition by range(a)
(partition p1 values less than(10) tablespace user_data,
 partition p2 values less than(20) tablespace temporary_data);
set echo off
PAUSE Verify through the Data Dictionary
set echo on
select table_name, partition_name, high_value, tablespace_name
from user_tab_partitions where table_name ='ABC';
set echo off
PAUSE Insert rows using the partition-extended name
set echo on
insert into abc partition (p1) values (1,'Rama');
insert into abc partition (p2) values (11,'Double A');
commit;
set echo off
PAUSE Now take the temporary tablespace offline
set echo on
connect system/aa
alter tablespace temporary_data offline;
set echo off
PAUSE Verify that partial data in partition p1 is still available
set echo on
connect scott/tiger
select * from abc partition (p1);
set echo off
PAUSE You cannot do a full table scan
set echo on
select * from abc;


p.47-48
SQL> @d:\aa\b2\working\partition
SQL> PROMPT General Setup
General Setup
SQL> set echo on
SQL> drop table abc;
Table dropped.
SQL> set echo off
Create a partition table with partitions p1 in the
user's default tablespace and partition p2 in the temporary
tablespace
SQL> create table abc(a number, b varchar2(10))
  2  partition by range(a)
  3  (partition p1 values less than(10) tablespace user_data,
  4   partition p2 values less than(20) tablespace temporary_data);
Table created.
SQL>
SQL> set echo off
Verify through the Data Dictionary
SQL> select table_name, partition_name, high_value, tablespace_name
  2  from user_tab_partitions where table_name ='ABC';
TABLE_NAME PARTITION_ HIGH_VALUE TABLESPACE_NAME
---------- ---------- ---------- ----------------
ABC        P2         20         TEMPORARY_DATA
ABC        P1         10         USER_DATA
2 rows selected.
SQL>
SQL> set echo off
Insert rows using the partition-extended name
SQL> insert into abc partition (p1) values (1,'Rama');
1 row created.
SQL> insert into abc partition (p2) values (11,'Double A');
1 row created.
SQL> commit;
Commit complete.
SQL> set echo off
Now take the temporary tablespace offline
SQL> connect system/aa
Connected.
SQL> alter tablespace temporary_data offline;
Tablespace altered.
SQL> set echo off
Verify that partial data in partition p1 is still available
SQL> connect scott/tiger
Connected.
SQL> select * from abc partition (p1);
        A B
--------- ----------
        1 Rama
1 row selected.
SQL> set echo off
You cannot do a full table scan
SQL> select * from abc;
ERROR:
ORA-00376: file 4 cannot be read at this time
ORA-01110: data file 4: 'D:\ORANT\DATABASE\TMP1ORCL.ORA'


p.55
SVRMGR> set transaction use rollback segment SYSTEM;


p.56
SVRMGR> SELECT CLASS, COUNT FROM V$WAITSTAT WHERE UPPER(CLASS) IN ('SYSTEM UNDO HEADER', 'SYSTEM UNDO BLOCK', 'UNDO HEADER','UNDO BLOCK');


p.57-58
REM: UNDO.SQL
set feedback off
set termout  off
column name format A40
define undo_overhead = 54
DROP TABLE undo$begin;
DROP TABLE undo$end;
CREATE TABLE undo$begin ( writes number );
CREATE TABLE undo$end ( writes number );
INSERT INTO undo$begin
SELECT sum(writes) FROM v$rollstat;
set termout on
set feedback on
REM: ̕ɂāCeXgp̃gUNVi[ĂTEST.SQLƂ
REM: ÕXNvgs܂D
@TEST.SQL
set termout off
set feedback off
INSERT INTO undo$end
SELECT sum(writes) FROM v$rollstat;
set termout on
set feedback on
SELECT  ( ( e.writes - b.writes) - &undo_overhead) "number of bytes generated"
FROM undo$begin b, undo$end e;
set termout off
set feedback off
DROP TABLE undo$begin;
DROP TABLE undo$end;


p.60
SELECT r.name "ROLLBACK SEGMENT NAME",
l.sid "ORACLE PID",
p.spid "SYSTEM PID",
NVL ( p.username , 'NO TRANSACTION'),
p.terminal
FROM v$lock l, v$process p, v$rollname r
WHERE  l.sid = p.pid(+)
AND TRUNC (l.id1(+)/65536) = r.usn
AND l.type(+) = 'TX'
AND l.lmode(+) = 6
ORDER BY r.name


p.60-61
SVRMGR> set transaction use rollback segment rb5;
Statement processed.
SVRMGR> insert into x values (90);
1 row processed.
SVRMGR> @d:\rvelpuri\rb
SVRMGR> SELECT r.name "ROLLBACK SEGMENT NAME",
     2> l.sid "ORACLE PID",
     3> p.spid "SYSTEM PID",
     4> NVL ( p.username , 'NO TRANSACTION'),
     5> p.terminal
     6> FROM v$lock l, v$process p, v$rollname r
     7> WHERE  l.sid = p.pid(+)
     8> AND TRUNC (l.id1(+)/65536) = r.usn
     9> AND l.type(+) = 'TX'
    10> AND l.lmode(+) = 6
    11> ORDER BY r.name
    12> ;

ROLLBACK SEGMENT NAME  ORACLE PID SYSTEM PI NVL(P.USERNAME, TERMINAL
---------------------- ---------- --------- --------------- ---------
RB1                                         NO TRANSACTION
RB3                                         NO TRANSACTION
RB4                                         NO TRANSACTION
RB5                            16 0012D     rvelpuri        RAMA
RB6                                         NO TRANSACTION
RB7                                         NO TRANSACTION
RB_TEMP                                     NO TRANSACTION
SYSTEM                                      NO TRANSACTION
8 rows selected.


p.62
01652, 00000, "unable to extend temp segment by %s in tablespace %s"*11


p.63
SVRMGR> SELECT SEGMENT_NAME, BYTES, EXTENTS FROM SYS.DBA_SEGMENTS
WHERE SEGMENT_TYPE='TEMPORARY';


SVRMGR> SELECT MAX(BYTES) FROM SYS.DBA_FREE_SPACE
WHERE TABLESPACE_NAME= tablespace_name;


p.64
SVRMGR> CREATE TABLESPACE temp_data DATAFILE '/oracle/temp.ora' SIZE 10M TEMPORARY


p.69
SVRMGR> ALTER DATABASE ADD LOGFILE GROUP 3 
('c:\orant\database\newlog1.ora'', ' 
d:\orant\database\newlog2.ora ') SIZE 500K;
SVRMGR> ALTER DATABASE ADD LOGFILE MEMBER ' 
e:\orant\database\newlog3.ora ' TO GROUP 3;


p.70
SVRMGR> ALTER DATABASE DROP LOGFILE MEMBER ' 
e:\orant\database\newlog3.ora ';
SVRMGR> ALTER DATABASE DROP LOGFILE GROUP 3;


p.73
SVRMGR> shutdown
SVRMGR> startup mount [dbname]
SVRMGR> alter database [dbname] archivelog;
SVRMGR> alter database [dbname] open;
SVRMGR> archive log all


SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Disabled
Archive destination            ?/dbs/arch
Oldest online log sequence     185
Next log sequence to archive   186
Current log sequence           186


p.74
SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home3/oradata/app/oracle/product/
                               7.3.2/dbs/arch
Oldest online log sequence     185
Next log sequence to archive   186
Current log sequence           186



Chapter3
p.84
SVRMGR> alter tablespace users begin backup;
SVRMGR> alter tablespace users end backup;


p.94
$ exp userid=system/manager full=Y inctype=complete constraints=Y
file=full_export_filename


p.95
$ exp userid=system/manager full=Y inctype=cumulative constraints=Y
file=cumulative_export_filename


$ exp userid=system/manager full=Y inctype=incremental constraints=Y
file=incremental_export_filename


p.98
$ backup/log/ignore=(interlock, nobackup) -
DiskA:[dir_path]*.dbs DiskB:[backup_dir_path]*.dbs

$ backup/log/ignore=interlock DiskA:[dir_path]*.rdo -
DiskB:[backup_dir_path]*.rdo

$ backup/log/ignore=interlock DiskA:[dir_path]*.con -
DiskB:[backup_dir_path]*.con


$ mount/foreign tape_device:
$ backup/log/ignore=interlock DiskA:[dir-path]*.dbs -
tape_device:db_test.bck/sav


p.99
$ mount/over=id tape_device:
$ copy  DiskA:[backup_dir_path]*.dbs  tape_device:


$ mount/foreign tape_device:
$ backup/rewind/list tape_device:*/sav


$ backup/rewind tape_device:db_test.bck/sav/select=(test.dbs,..) -
disk:[dir_path]file/new_version/owner=parent/log


$ mount tape_device: volume_label  !ɁC̃R}hgp邱Ƃł܂D
$ mount/over=id tape_device:
$ dir tape_device:                 !e[vׂ̂Ẵt@CXg\ꍇ
$ copy tape_device:file  disk:[dir_path]file  !t@Ce[voꍇ


p.100
$ ls /dsk*/ORACLE/prod/*.*  |  cpio -pdk new-dir

$ ls /dsk*/ORACLE/prod/*.dbf  |  cpio -pdk new-dir

$ ls /dsk*/ORACLE/prod/*.rdo  |  cpio -pdk new-dir


$ cpio -ic < /bck/arch010194


$ cat /bck/arch010194 | cpio -ic


p.101
$ cpio -icr < /bck/arch010194


$ ls /dsk*/ORACLE/*.* | cpio -ocBv  >  tape_device


$ find . -depth -print | cpio -ocBv  > tape_device


$ cpio itBv < tape_device


$ cpio -icBv file  < tape_device
$ cpio -icdBv file < tape_device


p.102
$ tar cf - . | ( cd to_dir; tar xf - )


$ tar -cvf  /dev/rmt0h  /dsk*/ORACLE/*.*


$ tar -tvf tape_device

$ tar -xvf tape_device


p.103
$ cp datafile  /bck/datafile

$ cp -r data_file_dir  bck_dir


p.104
$ dump 0Bf 400 /dev/rra2a  /bck/db_files


$ dump 0undf /dev/rmt0h /bck/db_files


p.105
$ restor r device           (ftHg̃foCX肵Ă)
$ restor r /dev/da0         (̃t@CVXéCfBXNda0ɃXgA)


$ restor x file


p.107
$ /etc/fbackup -f tape_device - g graph_file -u -0
$ /etc/fbackup -0I /usr -e /usr/lib -f /dev/rmt0h
$ cd /usr/adm/fbackupfiles
$ /etc/fbackup -0uc config -g graphs -I indices -f /dev/rmt0h
# graphs file
i         /dsk1
i         /dsk2
i         /dsk3/oracle
i         /dsk4/usr
e         /dsk1/usr/class
e         /dsk2/usr/test


p.115
C:\> OCOPY80 current_file backup_file
C:\> OCOPY80 /B current_file a:
C:\> OCOPY80 /R a: restore_dir



Chapter4
p.124-129
$!
$!
$!
$ vvv = 'f$verify(0)'  ! unoverifyvw肵C؂̎w𖳌ɂ
$! t@C:  ORACLE_UTILS:BACKUP_MAIN.COM
$!
$!          by: Saar Maoz, Oracle Worldwide Support
$!
$! ړI:     Oraclef[^x[X̃R[h/zbgobNAbvCGNX|[g̎s
$! N@:  submit backup_main.com -
$!          /parameters=(dbname, export mode, resubmit flag)
$!          ܂
$!          @oracle_utils:backup_main dbname [export mode] [resubmit flag]
$!
$!          :  @backup_main TESTDB COMPLETE YES
$!
$! p[^:
$!         P1: ̎sΏۂƂȂf[^x[X̖O
$!         P2: sGNX|[g̃^Cv: INCREMENTALCCUMULATIVEC
$!              ܂COMPLETE
$!         P3: ĎstOiIvVj: YESCNOiftHgl=YESj
$!            @ NOݒ肷ƁCYWu͗CĎsȂD
$!
$! {vV[WĂяovV[W:   
$!      oracle_utils:env_symbols_sample.com  !f[^x[XV{
$!                                            ̃ZbgAbv
$!      oracle_utils:export_database.com   ! f[^x[X̃GNX|[gs
$!      oracle_utils:hot_backup.com  ! f[^x[X̃zbgobNAbvs
$!      oracle_utils:cold_backup.com  ! f[^x[X̃R[hobNAbvs
$!
$! {vV[W̌Ăяo: ʏ́Csubmit_backup_dbname.com
$!      Tvt@Cisubmit_backup_TESTDB.samplej̓[U[ύXĂ
$!      ܂ȂD
$!
$! : V{: 𐧌䂷邽߂ɕύXłÃV{ɂĂ͖{XNvg
$!              "USER_PARAMETERS"ZNVQƂ̂ƁD
$!      _:   ORACLE_UTILŚCobNAbvXNvgׂĊi[ĂfB
$!               NgĂ邱ƁD
$!      t@C: Ȃ
$!
$! o: V{: Ȃ.
$!      _:   Ȃ.
$!      t@C:  ړIɂ͂ȂDCexport_database.comC
$!               hot_backup.comCoracle_utils:cold_backup.comւ
$!               Ăяoɂč쐬S܂͈ꕔ̃t@CΏۂƂĂ܂
$!               ȂD
$!
$!
$! KNOWN LIMITATIONS:
$!
$! : {XNvgOracleAJEgs邱ƂOł邽ߌ̃`FbN
$!      sȂD
$!
$! :
$!   t            O           Rg
$!   1995N320  Saar Maoz     쐬
$!
$!!!!!!!!  ̃ZNV́CobNAbvvV[W̍\pɃ[U[ύX\
$ USER_PARAMETERS:
$!
$! p[^_daysŏÎɂĂ͐l͂ȂD
$!
$  export_days := "/Sunday/"
$  hot_backup_days := "/Monday/Tuesday/Wednesday/Thursday/Friday/"
$  cold_backup_days := "/Saturday/"
$  userpasswd := system/manager
$  logfile := sys$scratch:save_database
$  mailuser = "SMAOZ"         ! [bZ[WKvłȂꍇ́C""ݒ
$!!!!!!!!!
$!
$ set noon
$!
$! ̓ɍĎsł悤ɁCs̊Jnۑ
$!
$ begin_time = f$time()
$!
$! {XNvgŎgp郍[JȃV{
$!
$ say := write sys$output
$ wo := write outfile
$ delfile := delete/noconfirm/log
$ sendmail := mail nl: 'mailuser' /subject=
$ something_done =0
$!
$! N@`FbN
$!
$ if p1 .eqs. "" then goto HELP
$ db_name = f$edit(p1,"UPCASE")
$ export_mode = f$edit(p2, "UPCASE")
$ submit_flag =  f$edit(p3, "UPCASE")
$ if submit_flag .eqs. "" then submit_flag := YES ! default value to submit flag
$!
$! ̐ݒ
$!
$ if f$trnlnm("oracle_utils") .eqs. "" then goto NO_LOGICAL
$ @oracle_utils:env_symbols_sample.com
$!
$! ̃R}hɂāCf[^x[XD
$! ORA_DB:ORAUSER_DBNAME.COMsĐf[^x[X悤ȃf[^
$! x[Xp̃V{CORACLE_UTILS:ENV_SYMBOLS_SAMPLE.COM̒Œ`
$! Ȃ΂ȂȂD
$!
$ 'db_name'
$ if .not. $status then goto NO_SYMBOL
$ show logical ora_sid
$!
$ today = f$cvtime("TODAY",,"WEEKDAY")   ! get day of week.
$!
$! [U[ɂĒ`Ă鐳ꏊɁCjɏ]ĕ򂷂D
$! 1ɕ̃^XNsĂ܂ȂD
$!
$ if f$locate("''today'",export_days) .ne. -
     f$length(export_days) then              call DO_EXPORT
$!
$ if f$locate("''today'",hot_backup_days) .ne. -
     f$length(hot_backup_days) then          call DO_HOT_BACKUP
$!
$ if f$locate("''today'",cold_backup_days) .ne. -
     f$length(cold_backup_days) then         call DO_COLD_BACKUP
$!
$! KvɉāC{XNvg𗂓ēxsD
$!
$ goto RESUBMIT
$!
$! sȂꍇ́C񃁃bZ[Wo
$!
$ if something_done then goto FINISH
$ say " "
$ say "INFORMATION ** ORACLE_UTILS:BACKUP_MAIN.COM **"
$ say " There was no backup/export defined to be done today, if this is a"
$ say " mistake check the USER_PARAMETERS section in"+-
      " ORACLE_UTILS:BACKUP_MAIN.COM"
$ goto FINISH
$!
$ DO_EXPORT: SUBROUTINE
$!
$! GNX|[gp̃[`Ăяo
$!
$ something_done =1
$ @oracle_utils:export_database 'db_name' 'export_mode'
$ EXIT
$ ENDSUBROUTINE
$!
$ DO_HOT_BACKUP: SUBROUTINE
$!
$! zbgobNAbvp̃[`Ăяo
$!
$ something_done =1
$ @oracle_utils:hot_backup 'db_name'
$ EXIT
$ ENDSUBROUTINE
$!
$ DO_COLD_BACKUP: SUBROUTINE
$!
$! R[hobNAbvp̃[`Ăяo
$!
$ something_done =1
$ @oracle_utils:cold_backup 'db_name'
$ EXIT
$ ENDSUBROUTINE
$!
$ RESUBMIT:
$!
$! KvɉāC{XNvg𗂓ēxsD
$!
$ if .not. submit_flag  then goto FINISH
$ submit oracle_utils:backup_main.com -
      /parameters=("''db_name'","''export_mode'","''submit_flag'") -
      /after="''begin_time'+23:59:59" -
      /log='logfile'_'db_name'.log -
      /queue=sys$batch -
      /retain=error -
      /noprint
$ if f$search("''logfile'") .nes. "" then purge/nolog/
$ keep=8 'logfile'
$!
$ goto FINISH
$!
$! G[ZNV
$!  {XNvg̈ȍ~́̕CG[p̃ZNVłDG[bZ[Wo͂
$!  тɁCMAIL_FINISHiE-mail𑗐MjFINISHiE-mail𑗐MȂjɕ򂷂D
$!  ftHǵCE-mailMD[ŃbZ[W𑗐MȂꍇ́CY
$!  xύX邱ƁD
$!
$ NO_SYMBOL:
$  say " "
$  say "ERROR ** ORACLE_UTILS:BACKUP_MAIN.COM **"
$  say " a. No symbol found with the database name that runs the"
$  say "    ORAUSER_<dbname>.COM which will point us to the right database,"
$  say "    add it to ORACLE_UTILS:ENV_SYMBOLS_SAMPLE.COM"
$  say " b. Some other error has occured while attempting to run the"
$  say "    ORAUSER_<dbname>.COM file, check the preceding VMS error message"
$  goto MAIL_FINISH
$!
$ NO_LOGICAL:
$  say " "
$  say "ERROR ** ORACLE_UTILS:BACKUP_MAIN.COM **"
$  say " The logical name ORACLE_UTILS is not defined please define it to point"
$  say " to the directory where all the backup scripts reside."
$  goto MAIL_FINISH
$!
$ HELP:
$  say " "
$  say "Usage of ORACLE_UTILS:BACKUP_MAIN.COM is:"
$  say " @ORACLE_UTILS:BACKUP_MAIN db_name [export mode] [submit]"
$  say " db_name : Database name"
$  say " export_mode : INCREMENTAL, CUMULATIVE or COMPLETE"
$  say " submit : YES | NO (default=YES)"
$  goto FINISH
$!
$ MAIL_FINISH:
$  if mailuser .eqs. "" then goto FINISH
$!
$! Θb^[hƃob`[ĥǂœ삵Ă邩ɉāC[𑗐MD
$!
$  msg = "Backup procedure run in interactive mode failed"
$  if f$mode() .eqs. "BATCH" then msg = "Backup procedure terminated"+-
         " with errors check ''logfile'_''db_name'.log for details"
$  sendmail "''msg'"
$  goto FINISH
$!
$ FINISH:
$  vvv='f$verify(vvv)'
$  Exit


p.129-134
$!
$!
$!
$ vvv = 'f$verify(0)'  ! unoverifyvw肵C؂̎w𖳌ɂ
$! t@C:  ORACLE_UTILS:EXPORT_DATABASE.COM
$!            by: Saar Maoz, Oracle Worldwide Support
$! ړI:      f[^x[X̑S̃GNX|[giINCREMENTALCCUMULATIVEC܂
$!            COMPLETEjsD
$! N@:  ʏ́Coracle_utils:backup_mainĂяoDC
$!            {vV[WʂɌĂяoꍇ́Ĉ悤Ɏw肷邱ƁD
$!            @oracle_utils:export_database dbname export_mode
$!
$!            :  @export_database TESTDB COMPLETE
$!
$! p[^:
$!           P1: GNX|[g̎sΏۂƂȂf[^x[X̖O
$!           P2: sGNX|[g̃^Cv: INCREMENTALCCUMULATIVEC܂
$!               w肵Ȃꍇ́CCOMPLETEftHglɂȂD
$!
$! {vV[WĂяovV[W:   
$!         oracle_utils:env_symbols_sample.com     ! f[^x[XV{
$!                                                   ̃ZbgAbv
$!         oracle_utils:db_name_devices_sample.com ! obNAbvΏۂ̃foCX
$!                                                   ̖O̎擾
$!         oracle_utils:instance_up            @@! CX^X̓/
$!                                            @@@ ~󋵂̃`FbN
$!         oracle_utils:startup_dbamode    @@@  ! RESTRICT[hł̋N
$!         ora_db:shutdown_db_name         @@@  ! normal[hŒ~
$!
$! {vV[W̌Ăяo:
$!          {XNvg͒ʏCBACKUP_MAIN.COMĂяoDC{XNvg
$!          ʂɌĂяoĂ܂ȂD
$!
$! :    V{:   {XNvg̏𐧌䂷邽߂ɕύXłÃV{ɂ
$!                      ͖{XNvgUSER_PARAMETERSZNVQƂ̂ƁD
$!          _:     ORACLE_UTILŚCobNAbvXNvgׂ
$!                      i[ĂfBNgĂ邱ƁD
$!          t@C:   Ȃ
$!
$! o:    V{:   Ȃ
$!          _:     Ȃ
$!          t@C:   export_location:export_db_name_export_mode.dmp
$!                      w肵CN^x̃GNX|[gt@CD
$!
$! :   {XNvgOracleAJEgs邱ƂOł邽
$!         ̃`FbN͎sȂD
$!
$! :
$!   t            O           Rg
$!   1995N320  Saar Maoz     쐬
$!
$!
$!!!!!!!!  ̃ZNV́CGNX|[gvV[W̍\pɃ[U[ύX\
$ USER_PARAMETERS:
$  export_buffer = 524288       ! Y[U[BYTLMl\ł邩mF邱ƁD
$! userpasswd := system/manager
$! mailuser = "SMAOZ"           ! [bZ[WKvłȂꍇ́C""ݒ
$!!!!!!!!!
$!
$ set noon
$!
$! {XNvgŎgp郍[JȃV{
$!
$ say := write sys$output
$ wo := write outfile
$ delfile := delete/noconfirm/log
$ sendmail := mail nl: 'mailuser' /subject=
$!
$! N@`FbN
$!
$ if p1 .eqs. "" then goto HELP
$ db_name = f$edit(p1,"UPCASE")
$ export_mode = f$edit(p2,"UPCASE")
$ if export_mode  .eqs. "" then export_mode := COMPLETE  !ftHgl
$!
$ if export_mode .nes. "INCREMENTAL" .and. export_mode .nes. -
     "CUMULATIVE" .and. export_mode .nes.  "COMPLETE" then HELP
$!
$ if f$type(userpasswd) .eqs. "" .or. f$type(mailuser) .eqs. "" -
     then goto NO_SYMS
$!
$ say " "
$ say "ORACLE_UTILS:EXPORT_DATABASE.COM begins a ''export_mode' export on"
$ say " ''db_name' database at: "+f$time()
$ say " "
$!
$! ̐ݒ
$!
$ if f$trnlnm("oracle_utils") .eqs. "" then goto NO_LOGICAL
$ @oracle_utils:env_symbols  !PȂmF
$!
$! ̃R}hɂāCf[^x[XD
$! ORA_DB:ORAUSER_DBNAME.COMsĐf[^x[X悤ȃf[^
$! x[Xp̃V{CORACLE_UTILS:ENV_SYMBOLS_SAMPLE.COM̒Œ`
$! Ȃ΂ȂȂD
$!
$ 'db_name'
$ if .not. $status then goto NO_SYMBOL
$ show logical ora_sid
$ @oracle_utils:'db_name'_devices_sample.com ! Define export location
$!
$! GNX|[g悪݂CꂪfBXNł邱Ƃ`FbN
$!
$ show logical export_location
$ if .not. f$getdvi("export_location","EXISTS") then goto NO_EXPORT_LOCATION
$ if f$getdvi("export_location","DEVCLASS") .ne. 1 then goto NOT_A_DISK
$ show device export_location
$!
$! CX^XNĂ邩`FbN
$!
$ @oracle_utils:instance_up 'f$trnlnm("ora_sid")'
$!
$ if instance_up then goto EXPORT
$!
$ say " "
$ say "ORACLE_UTILS:EXPORT_DATABASE.COM"
$ say " Instance was shutdown and an export is due so starting database up..."
$ say " "
$ @oracle_utils:startup_dbamode 'db_name'
$!
$ EXPORT:
$ say " "
$ say "ORACLE_UTILS:EXPORT_DATABASE.COM is now deleting last week's export"
$ say " "
$ if f$search("export_location:export_''db_name'_''export_mode'.dmp") .nes. ""
$ then
$   directory/date=(created,backup)/size=all -
      export_location:export_'db_name'_'export_mode'.dmp
$   delfile export_location:export_'db_name'_'export_mode'.dmp;*
$ endif
$!
$! ۂ̃GNX|[g̎s
$!
$ on error then goto EXPORT_ERROR
$ exp userid='userpasswd' -
      buffer='export_buffer' -
      file=export_location:export_'db_name'_'export_mode'.dmp -
      inctype='export_mode' -
      full=y -
      grants=y -
      indexes=y -
      rows=y -
      constraints=y -
      compress=n -
      statistics=none
$!
$ say " "
$ say "ORACLE_UTILS:EXPORT_DATABASE.COM finished a ''export_mode' export on"
$ say " ''db_name' database at: "+f$time()
$ say " "
$ if mailuser .nes. "" then  sendmail -
     "''export_mode' export finished successfully at ''f$time()'"
$!
$ if .not. instance_up
$ then
$   say " "
$   say "ORACLE_UTILS:EXPORT_DATABASE.COM"
$   say " The database was shutdown when export begun, so bringing it back down"
$   say " "
$   @ora_db:shutdown_'db_name'
$ endif
$ goto FINISH
$!
$! G[ZNV
$!  {XNvg̈ȍ~́̕CG[p̃[`łDG[bZ[Wo
$!  邽тɁCMAIL_FINISHiE-mail𑗐MjFINISHiE-mail𑗐MȂj
$!  ɕ򂷂DftHǵCE-mailMD[ŃbZ[W𑗐M
$!  Ȃꍇ́CY郉xύX邱ƁD
$!
$ NO_SYMS:
$  say " "
$  say "ERROR ** ORACLE_UTILS:EXPORT_DATABASE.COM **"
$  say " The local symbols userpasswd or mailuser are not defined"
$  say " This usually means that this script was called independently and the"
$  say " USER_PARAMETERS section of this script was not updated"
$  say " "
$  goto FINISH
$!
$ NO_LOGICAL:
$  say " "
$  say "ERROR ** ORACLE_UTILS:EXPORT_DATABASE.COM **"
$  say " The logical name ORACLE_UTILS is not defined. Please define it to"
$  say " point to the directory where all the backup scripts reside."
$  goto MAIL_FINISH
$!
$ NO_SYMBOL:
$  say " "
$  say "ERROR ** ORACLE_UTILS:EXPORT_DATABASE.COM **"
$  say " a. No symbol found with the database name that runs the"
$  say "    ORAUSER_dbname.COM which will point us to the right database,"
$  say "    add it to ORACLE_UTILS:ENV_SYMBOLS_SAMPLE.COM"
$  say " b. Some other error has occured while attempting to run the"
$  say "    ORAUSER_dbname.COM file, check the preceding VMS error message"
$  goto MAIL_FINISH
$!
$ NO_EXPORT_LOCATION:
$  say " "
$  say "ERROR ** ORACLE_UTILS:EXPORT_DATABASE.COM **"
$  say " The logical name EXPORT_LOCATION which controls where the export file"
$  say " will be created is not defined."
$  goto MAIL_FINISH
$!
$ NOT_A_DISK:
$  say " "
$  say "ERROR ** ORACLE_UTILS:EXPORT_DATABASE.COM **"
$  say " The export location pointed to by EXPORT_LOCATION logical name is not"
$  say " a disk.  Sorry, this script does not currently do exports to tape."
$  goto MAIL_FINISH
$!
$ EXPORT_ERROR:
$  st=$status
$  say " "
$  say "ERROR ** ORACLE_UTILS:EXPORT_DATABASE.COM **"
$  say " An error has occured during the export, final VMS error code: ''st'"
$  say " Text: "+f$message(st)
$  goto MAIL_FINISH
$!
$ HELP:
$  say " "
$  say "Usage of ORACLE_UTILS:EXPORT_DATABASE.COM is:"
$  say " @ORACLE_UTILS:EXPORT_DATABASE db_name export_mode"
$  say " db_name : Database name to export"
$  say " export_mode : INCREMENTAL, CUMULATIVE or COMPLETE"
$  goto FINISH
$!
$ MAIL_FINISH:
$  if mailuser .eqs. "" then goto FINISH
$!
$! Θb^[hƃob`[ĥǂœ삵Ă邩ɉāC[𑗐MD
$!
$  msg = "''export_mode' export run in interactive mode failed"
$  if f$mode() .eqs. "BATCH" then msg = "''export_mode' export terminated"+-
         " with errors check ''logfile'_''db_name'.log for details"
$  sendmail "''msg'"
$  goto FINISH
$!
$ FINISH:
$  vvv= 'f$verify(vvv)'
$  Exit


p.136-146
$!
$!
$!
$ vvv = 'f$verify(0)'  ! unoverifyvw肵C؂̎w𖳌ɂ
$! t@C: ORACLE_UTILS:HOT_BACKUP.COM
$!         @by: Saar Maoz, Oracle Worldwide Support
$! ړI:     f[^x[X́uzbgvobNAbvsD
$! N@: ʏ́Coracle_utils:backup_mainĂяoDC
$!           {vV[WʂɌĂяoꍇ́Ĉ悤Ɏw肷邱ƁD
$!           @oracle_utils:hot_backup dbname
$!
$!          :  @hot_backup TESTDB
$!
$! p[^:
$!          P1: zbgobNAbv̎sΏۂƂȂf[^x[X̖O
$!
$! {vV[WĂяovV[W:   
$!          oracle_utils:env_symbols.com     ! f[^x[XV{
$!                                             ZbgAbv
$!          oracle_utils:db_name_devices.com ! obNAbvΏۂ̃foCX
$!                                             O̎擾
$!          oracle_utils:instance_up         ! CX^X̓/
$!                                             ~󋵂̃`FbN
$!          oracle_utils:tbs_to_datafiles.sql  ! \̈/f[^t@C
$!                                               Xg̐
$!          oracle_utils:tablespace_state.sql  ! \̈̏Ԃ̕\
$!          oracle_utils:hot_backup_cmd_db_name.com ! zbgobNAbv
$!                                                    ̎s
$!          |-> oracle_utils:env_symbols.com
$!          |-> oracle_utils:backup_tablespace ! 1\̈敪̃obNAbv
$!          |-> oracle_utils:instance_up
$!          |-> ora_db:ora_db_db_name  ! ora_control*_obNAbv̎擾
$!
$! vV[W̌Ăяo:
$!          {XNvg͒ʏCBACKUP_MAIN.COMĂяoDC{XNvg
$!          ʂɌĂяoĂ܂ȂD
$!
$! : V{:  {XNvg̏𐧌䂷邽߂ɕύXłÃV{ɂĂ
$! @@  @@@@ @ {XNvg"USER_PARAMETERS"ZNVQƂ̂ƁD
$! @@@ _:@  ORACLE_UTILŚCobNAbvXNvgׂĊi[Ă
$!            @  fBNgĂ邱ƁD
$!            @  ORA_CONTROL*ɂ́Cora_db:ora_db_db_name.comɂĒ`
$!            @  Ă
$!@@@  t@C:  backup_location_1:tbs_to_datafiles.lisobNAbv  
$!            @  ΏۂƂȂ\̈/f[^t@C
$!
$! o: V{:  Ȃ
$! @@@ _:@  Ȃ
$!@@@  t@C:  * oracle_utils:hot_backup_cmd_db_name.com
$!                   ́CIɍ쐬DCLXNvgłD̃XNvǵC
$!                   Server Manager̒ɓC\̈؂ւăobNAbv
$!                   ̊Jn/IsCY\̈̃obNAbv
$!                   oracle_utils:backup_tablespaceĂяočsD
$!                   ̏́CׂĂ̕\̈ɑ΂ĎsDIƁC
$!                   t@C̃Rs[ۑD
$!
$!             * backup_location_1:restore_database.com
$!                   ́CIɍ쐬DCLXNvgłCYzbgobN
$!                   AbṽXgAsD̃t@Cgpꍇ́C{X
$!                   Nvgɂăf[^x[X̃Rs[XgACf[^x[X
$!                   ̎ۂ̉񕜏sKvD
$!                   ̃t@Cɂ̓obNAbvs̃f[^x[X̊et@C
$!                   Rs[foCXL^Ă邽߁C̃t@C͕ۑĂ
$!                   ƁDڍׂɂẮC̃t@CQƂ̂ƁD
$!
$!             * backup_location_1:tbs_to_datafiles.lis
$!                   ́CSELECT̏o͂łC̃t@CΕ\̈
$!                   уf[^t@C̖OƃTCYiVMS̃ubNj킩D
$!                   ̃t@C̃R[h̗CɎD
$!      "SYSTEM|DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]
$!       ORA_SYSTEM.DBS|12288"
$!                   ̃t@ĆCoracle_utils:tbs_to_datafiles.sql
$!                   č쐬D
$!
$!              * Yf[^x[X1̐t@C̃obNAbv́C擪̃obN
$!                AbvfoCXɊi[D
$!
$! : {XNvgOracleAJEgs邱ƂOł邽ߌ̃`FbN
$!      sȂD
$!
$! :
$!   t            O          Rg
$!   1997N124  DJ Cover     SQLDBASVRMGRLɕύXDoOtBbNXD
$!   1995N320  Saar Maoz    쐬
$!
$!!!!!!!! ̃ZNV́CobNAbvvV[W̍\pɃ[U[ύX\
$ USER_PARAMETERS:
$!
$! {XNvgPƂŎgpꍇ́C2s̃Rg邱ƁD
$! userpasswd := system/manager
$! mailuser = "SMAOZ"           ! [bZ[WKvłȂꍇ́C""ݒ
$!!!!!!!!
$!
$ set noon
$!
$! {XNvgŎgp郍[JȃV{
$!
$ say := write sys$output
$ wo := write outfile
$ wo2 := write outfile2
$ delfile := delete/noconfirm/log
$ backupfile := backup/log/ignore=(interlock,nobackup)/new
$ sendmail := mail nl: 'mailuser' /subject=
$!
$! N@`FbN
$!
$ if p1 .eqs. "" then goto HELP
$ db_name = f$edit(p1,"UPCASE")
$!
$ if f$type(userpasswd) .eqs. "" .or. f$type(mailuser) .eqs. "" -
     then goto NO_SYMS
$!
$ say " "
$ say "ORACLE_UTILS:HOT_BACKUP.COM begins a hot backup on"+-
      " ''db_name' database at: "+f$time()
$ say " "
$!
$! ̐ݒ
$!
$ if f$trnlnm("oracle_utils") .eqs. "" then goto NO_LOGICAL
$ @oracle_utils:env_symbols  !PȂmF
$!
$! ̃R}hɂāCf[^x[XD
$! ORA_DB:ORAUSER_DBNAME.COMsĐf[^x[X悤ȃf[^
$! x[Xp̃V{CORACLE_UTILS:ENV_SYMBOLS.COM̒Œ`ĂȂ
$! ȂȂD
$!
$ 'db_name'
$ if .not. $status then goto NO_SYMBOL
$ show logical ora_sid
$ @oracle_utils:'db_name'_devices.com   ! gp\ȃobNAbv̊i[ꏊ̒`
$!
$! gp\ȃfoCX̃JEgifBXN̂݁j
$!
$ show log backup_location_*
$ device_cnt=1
$ DEV_LOOP:
$  if .not. f$getdvi("backup_location_''device_cnt'","EXISTS") -
      then goto DEV_VER  ! foCX݂邩mF
$  if f$getdvi("backup_location_''device_cnt'","DEVCLASS") .ne. 1 -
      then goto DEV_VER  ! foCXfBXNł邩mF
$  show device backup_location_'device_cnt'
$  device_cnt= device_cnt+1
$ goto DEV_LOOP
$!
$ DEV_VER:
$  device_cnt= device_cnt-1
$  if device_cnt .eq. 0 then goto NO_BACKUP_DEVICES ! foCXȂꍇ
$!
$  say " "
$  say "ORACLE_UTILS:HOT_BACKUP.COM has recognized ''device_cnt' devices to"+-
     " use for backup."
$  say " "
$!
$! CX^XオĂ邩`FbN
$!
$ @oracle_utils:instance_up 'f$trnlnm("ora_sid")'
$ if .not. instance_up then goto UP_FOR_HOT  ! zbgobNAbvsɂ
$!                                             DBオĂȂ΂ȂȂ
$!
$! \̈/f[^t@C̃Xgt@C̐Ƌt@C̍폜
$!
$ if f$search("backup_location_1:tbs_to_datafiles.lis") .nes. "" -
     then delfile/nolog backup_location_1:tbs_to_datafiles.lis;*
$ if f$search("oracle_utils:hot_backup_cmd_''db_name'.com") .nes. "" -
     then purge/nolog/keep=2 oracle_utils:hot_backup_cmd_'db_name'.com
$!
$ sqlplus -s 'userpasswd'  @oracle_utils:tbs_to_datafiles.sql
$!
$! \̈/f[^t@C̃Xgt@C̃I[vD̃t@C݂Ȃꍇ́C炩
$! QĂD
$!
$ close/nolog infile
$ open/read/error=OPEN_TBS_ERROR infile 
  backup_location_1:tbs_to_datafiles.lis
$ read/end=EMPTY_TBS_LIST infile rec  ! t@C̐擪siRgjXLbv
$!
$! Server Manager̒ɓĎۂALTER TABLESPACE BEGIN BACKUPsC
$! VMS̃obNAbvsČALTER TABLESPACE END BACKUPs悤
$! XNvg̍쐬JnD
$!
$ close/nolog outfile
$ open/write outfile oracle_utils:hot_backup_cmd_'db_name'.com
$!
$ wo "$! FILE:  oracle_utils:hot_backup_cmd_''db_name'.com"
$ wo "$! Dynamically created by ORACLE_UTILS:HOT_BACKUP.COM at: ''f$time()'"
$ wo "$! to perform hot backup of ''db_name' database"
$ wo "$ set noon"
$ wo "$ if f$search(""backup_location_1:alter_tbs_begin_end.log"") -"
$ wo " .nes. """" then delfile/nolog backup_location_1:tbs_tbs_begin_end.log;*"
$ wo "$ vvv = 'f$verify(1)' ! Server Manager̃R}h悤Ɍ؂LɂD"
$ wo "$ SVRMGRL"
$ wo "connect internal"
$ wo "alter system archive log current;"  ! JgREDOOt@C؂ւC
$!                                        ! ̃A[JCus邽
$ wo "  REM It is normal to get warning messages from backup in the form:"
$ wo "  REM %BACKUP-W-ACCONFLICT, <file name> is open for write by another user"
$!
$! \̈1
$!
$ prv_tbs = ""
$LOOP:
$ read/end=END_INFILE infile rec
$ tbs = f$element(0,"|",rec)             ! \̖̈O𒊏o
$ file = f$element(1,"|",rec)            ! t@C̎dl𒊏o
$ size = f$element(2,"|",rec)            ! t@C̃TCY𒊏o
$!
$ if tbs .eqs. prv_tbs then goto LOOP    ! ς݂̏ꍇ̓XLbv
$!
$ if prv_tbs .eqs. ""
$ then
$   wo "spool backup_location_1:alter_tbs_begin_end.log"
$   wo "alter tablespace ''tbs' begin backup;"
$   wo "spool off"
$ else
$   wo "spool backup_location_1:alter_tbs_begin_end.log"
$   wo "alter tablespace ''prv_tbs' end backup;"
$   wo "spool off"
$   wo "spool backup_location_1:alter_tbs_begin_end.log"
$   wo "alter tablespace ''tbs' begin backup;"
$   wo "spool off"
$ endif
$!
$ wo "host @oracle_utils:backup_tablespace ''tbs' ''db_name' ''device_cnt'"
$ prv_tbs = tbs
$!
$ goto LOOP
$END_INFILE:
$!
$! Ō̕\̈end backupR}hǉCt@C̃Rs[ۑ
$!
$ wo "spool backup_location_1:alter_tbs_begin_end.log"
$ wo "alter tablespace ''tbs' end backup;"
$ wo "spool off"
$ wo "alter database backup controlfile to "+-
  "''''backup_location_1:ora_control_''db_name'.con'''';"
$ wo "exit"
$ wo "$ vvv = 'f$verify(vvv)'"
$ wo "$ exit"
$ close/nolog outfile
$ close/nolog infile
$!
$ say "ORACLE_UTILS:HOT_BACKUP.COM is now deleting previous backup files"
$ say " on all devices with the name BACKUP_LOCATION_*"
$ say " "
$ dev_cnt=1
$ DELETE_YESTERDAYS_BCK:
$!
$ delfile backup_location_'dev_cnt':*.*.* - ! 쐬΂̕\̈/f[^
          /exclude=(*.lis.*,*.dmp.*)        ! t@C̃Xgt@CGNX
$!                                          ! |[gt@C폜Ȃ
$ dev_cnt=dev_cnt+1
$ if dev_cnt .lt. device_cnt then goto  DELETE_YESTERDAYS_BCK
$!
$! ̃obNAbv烊XgAsƂɎgp
$! RESTORE_DATABASE.COM̍쐬Jn
$!
$ close/nolog outfile2
$ open/write outfile2 backup_location_1:restore_database.com
$ wo2 "$!FILE: backup_location_1:restore_database.com"
$ wo2 "$!Dynamically created by ORACLE_UTILS:HOT_BACKUP.COM at: "+-
        f$time()
$ wo2 "$!"
$ wo2 "$ type sys$input"
$ wo2 "  This script will restore all database files from their backup location"
$ wo2 "  to their location on production environment. It will first delete the"
$ wo2 "  database file if it exists in the production environment, and then"
$ wo2 "  copy a backup of that file to that location."
$ wo2 "  It will then copy all the control files to their location in"
$ wo2 "  the same fashion (deleting the production ones first)."
$ wo2 " "
$ wo2 "  This script should be run only if you plan to perform a database"
$ wo2 "  recovery from a HOT backup."
$ wo2 "  To invoke this script edit it and remove the EXIT statement following"
$ wo2 "  this notice"
$ wo2 "$!"
$ wo2 "$ EXIT"
$ wo2 "$!"
$ wo2 "$ db_name := ''db_name'"
$ wo2 "$ if f$trnlnm(""oracle_utils"") .eqs. """" then goto NO_LOGICAL"
$ wo2 "$ @oracle_utils:env_symbols"
$ wo2 "$ ''''db_name''''"
$ wo2 "$ @ora_db:ora_db_''''db_name''''" ! ora_control*̘_obNAbv
$                                        ! 擾邽
$ wo2 "$ if f$trnlnm(""ora_control1"") .eqs. """" then goto NO_CTL_LOGICALS"
$ wo2 "$!"
$ wo2 "$ @oracle_utils:instance_up ''''f$trnlnm(""ora_sid"")''''"
$ wo2 "$ if instance_up then goto INSTANCE_UP"
$ wo2 "$!"
$ wo2 "$ @oracle_utils:''db_name'_devices"
$ wo2 "$!"
$ wo2 "$ set noon"
$ wo2 "$!"
$ wo2 "$ delfile := ''delfile'"
$ wo2 "$ backupfile := ''backupfile'"
$ wo2 "$!"
$ close/nolog outfile2
$!
$! ׂĂ̕\̈̃obNAbv1s߂ɍ쐬΂̃XNvgĂяoD
$!
$ sqlplus -s 'userpasswd'  @oracle_utils:tablespace_state.sql ! sȌ
$ @oracle_utils:hot_backup_cmd_'db_name'.com
$ sqlplus -s 'userpasswd'  @oracle_utils:tablespace_state.sql ! s̏
$!
$! obNAbvׂ̂Ă̊Jn/ĨOG[DG[ꍇ́CG[
$!
$ search backup_location_1:alter_tbs_begin_end.log;* "ORA-"/exact/win=1
$ if $status .ne. %X08D78053 then goto HOT_BACKUP_PROBLEM
$!
$! ̗Lpȏrestore_databaset@Cɏ
$!
$ close/nolog outfile2
$ open/append outfile2 backup_location_1:restore_database.com
$ wo2 "$!"
$ wo2 "$ type sys$input"
$ wo2 "  Restoration of all data files of database ''db_name' has"
$ wo2 "  been completed. Please review the log file or screen for any errors."
$ wo2 "  Since this restore was from a HOT backup, you will need to recover"
$ wo2 "  the database before you are able to use it.  Go into SQLDBA"
$ wo2 "  and issue:"
$ wo2 "  1. connect internal"
$ wo2 "  2. startup MOUNT ''db_name';"
$ wo2 "  3. set autorecovery ON;
$ wo2 "  4. recover database; (or add the until clause)"
$ wo2 "  5. Then ALTER DATABASE OPEN; (use RESETLOGS in case of an"+-
      " incomplete recovery)"
$ wo2 " "
$ wo2 " Note: The controlfiles were not restored, if you need to use them"
$ wo2 "       please do so manually."
$ wo2 " "
$ wo2 "  Good Luck!"
$ wo2 "$ goto FINISH"
$ wo2 "$!"
$ wo2 "$ INSTANCE_UP:"
$ wo2 "$ type sys$input"
$ wo2 "ERROR ** BACKUP_LOCATION_1:RESTORE_DATABASE.COM **"
$ wo2 "  The database is UP.  One or more processes belonging to this database"
$ wo2 "  is still running.  This script should be run when the database is"
$ wo2 "  DOWN.  Make sure the database is down; if necessary, issue a SHUTDOWN"
$ wo2 "  ABORT, then rerun this script to restore a backup of this database."
$ wo2 "$ goto FINISH"
$ wo2 "$!"
$ wo2 "$ NO_LOGICAL:"
$ wo2 "$ type sys$input"
$ wo2 "ERROR ** BACKUP_LOCATION_1:RESTORE_DATABASE.COM **"
$ wo2 " The logical name ORACLE_UTILS is not defined. Please define it to point"
$ wo2 " to the directory where all the backup scripts reside."
$ wo2 "$ goto FINISH"
$ wo2 "$!"
$ wo2 "$ NO_CTL_LOGICALS:"
$ wo2 "$ type sys$input"
$ wo2 "ERROR ** BACKUP_LOCATION_1:RESTORE_DATABASE.COM **"
$ wo2 "  Can't find the controlfile logicals (ORA_CONTROL*)."
$ wo2 "  They are usually defined in ORA_DB:ORA_DB_''db_name'.COM, and not"
$ wo2 "  hardcoded as controlfile names in the init.ora file"
$ wo2 "$ goto FINISH"
$ wo2 "$!"
$ wo2 "$ FINISH:"
$ wo2 "$ Exit"
$ close/nolog outfile2
$!
$ say " "
$ say "ORACLE_UTILS:HOT_BACKUP.COM finished a hot backup on"+-
      " ''db_name' database at: "+f$time()
$ say " "
$ if mailuser .nes. "" then sendmail -
  "HOT backup operation for ''db_name' database completed at: ''f$time()'"
$!
$ goto FINISH
$!
$! G[ZNV
$!  {XNvg̈ȍ~́̕CG[p̃[`łDG[bZ[Wo͂
$!  тɁCMAIL_FINISHiE-mail𑗐MjFINISHiE-mail𑗐MȂjɕ򂷂D
$!  ftHǵCE-mailMD[ŃbZ[W𑗐MȂꍇ́CY
$!  xύX邱ƁD
$!
$ NO_SYMS:
$  say " "
$  say "ERROR ** ORACLE_UTILS:HOT_BACKUP.COM **"
$  say " The local symbols userpasswd or mailuser are not defined"
$  say " This usually means that this script was called independently and the"
$  say " USER_PARAMETERS section of this script was not updated"
$  say " "
$  goto FINISH
$!
$ NO_LOGICAL:
$  say " "
$  say "ERROR ** ORACLE_UTILS:HOT_BACKUP.COM **"
$  say " The logical name ORACLE_UTILS is not defined. Please define it to"
$  say " point to the directory where all the backup scripts reside."
$  goto MAIL_FINISH
$!
$ NO_SYMBOL:
$  say " "
$  say "ERROR ** ORACLE_UTILS:HOT_BACKUP.COM **"
$  say " a. No symbol found with the database name that runs the"
$  say "    ORAUSER_<dbname>.COM, which will point us to the right database."
$  say "    Add it to ORACLE_UTILS:ENV_SYMBOLS.COM."
$  say " b. Some other error has occured while attempting to run the"
$  say "    ORAUSER_<dbname>.COM file. Check the preceding VMS error message."
$  goto MAIL_FINISH
$!
$ NO_BACKUP_DEVICES:
$  say " "
$  say "ERROR ** ORACLE_UTILS:HOT_BACKUP.COM **"
$  say " No backup locations with the name BACKUP_LOCATION_* found."
$  say " Please define some backup locations in ''db_name'_DEVICES.COM"
$  say " and verify that the devices exist."
$  goto MAIL_FINISH
$!
$ UP_FOR_HOT:
$  say " "
$  say "ERROR ** ORACLE_UTILS:HOT_BACKUP.COM **"
$  say " The database ''db_name' is down, and a hot backup was attempted"
$  goto MAIL_FINISH
$!
$ OPEN_TBS_ERROR:
$  say " "
$  say "ERROR ** ORACLE_UTILS:HOT_BACKUP.COM **"
$  say " An error has occured opening the tablespace datafiles mapping file."
$  say " It is located in BACKUP_LOCATION_1:TBS_TO_DATAFILES.LIS."
$  say " Please verify that the location is a valid directory owned by Oracle"
$  say " or the person running this script.  Also make sure that the Oracle"
$  say " shareable images are installed using ORA_RDBMS:INSORACLE.COM, which"
$  say " is required to run sqlplus"
$  goto MAIL_FINISH
$!
$ EMPTY_TBS_LIST:
$  say " "
$  say "ERROR ** ORACLE_UTILS:HOT_BACKUP.COM **"
$  say " Found tablespace listings file empty"+-
$      " (BACKUP_LOCATION_1:TBS_TO_DATAFILES.LIS)"
$  goto MAIL_FINISH
$!
$ HOT_BACKUP_PROBLEM:
$  say " "
$  say "ERROR ** ORACLE_UTILS:HOT_BACKUP.COM **"
$  say " ALTER TABLESPACE BEGIN or END BACKUP command was issued."
$  say " Please check logfile or backup_location_1:alter_tbs_begin_end.log;*"
$  say " for more details."
$  goto MAIL_FINISH
$!
$ HELP:
$  say " "
$  say "Usage of ORACLE_UTILS:HOT_BACKUP.COM is:"
$  say " @ORACLE_UTILS:HOT_BACKUP <db_name>"
$  goto FINISH
$!
$ MAIL_FINISH:
$  if mailuser .eqs. "" then goto FINISH
$!
$! Θb^[hƃob`[ĥǂœ삵Ă邩ɉāC[𑗐MD
$!
$  msg = "HOT backup procedure run in interactive mode failed"
$  if f$mode() .eqs. "BATCH" then msg = "HOT backup procedure terminated"+-
         " with errors check ''logfile'_''db_name'.log for details"
$  sendmail "''msg'"
$  goto FINISH
$!
$ FINISH:
$  close/nolog infile
$  close/nolog outfile
$  close/nolog outfile2
$ vvv= 'f$verify(vvv)'
$  exit


p.147-159
$!
$!
$!
$ vvv = 'f$verify(0)'  ! unoverifyvw肵C؂̎w𖳌ɂ
$! t@C: ORACLE_UTILS:COLD_BACKUP.COM
$! ړI:    f[^x[X́uR[hvobNAbvsD
$! N@: ʏ́Coracle_utils:backup_main.comĂяoD
$!         C{vV[WʂɌĂяoꍇ́Ĉ悤Ɏw肷邱ƁD
$!          @oracle_utils:cold_backup dbname
$!
$!          :  @cold_backup TESTDB
$!          :  @cold_backup TESTDB
$!
$! p[^:
$!          P1: R[hobNAbv̎sΏۂƂȂf[^x[X̖O
$!
$! {vV[WĂяovV[W:   
$!          oracle_utils:env_symbols.com ! f[^x[XV{̃ZbgAbv
$!          oracle_utils:db_name_devices.com  ! obNAbvΏۂ̃foCX
$!                                              O̎擾
$!          oracle_utils:instance_up          ! CX^X̓/
$!                                              ~󋵂̃`FbN
$!          oracle_utils:shutdown_immediate   ! ~
$!          oracle_utils:startup_dbamode      ! RESTRICT[hł̋N
$!          oracle_utils:tbs_logfiles.sql     ! \̈/f[^t@C/REDO
$!                                              ÕXg
$!          oracle_utils:backup_tablespace    ! 1\̈敪̃obNAbv
$!          ora_db:ora_db_db_name             ! ora_control* _obN
$!                                              Abv̎擾
$!          ora_db:shutdown_db_name           ! NORMAL[hł̒~
$!                                              
$!          ora_db:startup_exclusive_db_name  ! f[^x[X̋N
$!
$! {vV[W̌Ăяo:
$!          {XNvg͒ʏCBACKUP_MAIN.COMĂяoDC{XN
$!          vgʂɌĂяoĂ܂ȂD
$!
$! :  V{:{XNvg̏𐧌䂷邽߂ɕύXłÃV{ɂẮC
$!                 {XNvg"USER_PARAMETERS"ZNVQƂ̂ƁD
$!        _:  ORACLE_UTILŚCobNAbvXNvgׂĊi[ĂfB
$!                 NgĂ邱ƁD
$!                 ORA_CONTROL*ɂ́Cora_db:ora_db_db_name.comɂĒ`
$!                 Ă鐧t@CiORA_PARAMŚCnode_SID_INIT.ORA
$!                 t@Cj̘_i[ĂD
$!        t@C:backup_location_1:tbs_to_datafiles.lisobNAbv 
$!                 ̑ΏۂƂȂ\̈/f[^t@C
$!
$! o:  V{: None.
$!        _:   Ȃ
$!        t@C: * backup_location_1:restore_database.com
$!                 ́CIɍ쐬DCLXNvgłCYR[hobN
$!                 AbṽXgAsD̃t@CgpăR[hob
$!                 NAbv烊XgAśC񕜏sȂĂf[
$!                 ^x[XI[vłD
$!                 ̃t@Cɂ̓obNAbvs̃f[^x[X̊et@C̃R
$!                 s[foCXL^Ă邽߁C̃t@C͕ۑĂƁD
$!                 ڍׂɂẮC̃t@CQƂ̂ƁD
$!
$!                 * backup_location_1:tbs_to_datafiles.lis
$!                 ́CSELECT̏o͂łC̃t@CΕ\̈您
$!                 f[^t@C̖OƃTCYiVMS̃ubNj킩DR[h
$!                 obNAbv[hł́CREDOO̖OƃTCỸt@CɊi[
$!                 D  
$!                 ̃t@C̃R[h̗ɎD
$!      "SYSTEM|DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]
$!      ORA_SYSTEM.DBS|12288"
$!      "  |DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]ORA_LOG1.RDO|1000"
$!               ̃t@ĆCoracle_utils:tbs_logfiles.sqlɂč쐬D
$!
$!              * Yf[^x[XREDOÕobNAbv́Cgp\ȃobNAbv
$!                foCX1Ɋi[D
$!
$!              * Yf[^x[X1̐t@C̃obNAbv́C擪̃obNA
$!             bvfoCXɊi[D
$!
$!              * INIT.ORAnodename_SID_INIT.ORAƂp[^t@C
$!                obNAbv́C擪̃obNAbvfoCXɊi[D
$!
$! : {XNvgOracleAJEgs邱ƂOł邽ߌ̃`FbN͎s
$!      ȂD
$!
$! :
$!   t            @O        @@Rg
$!   1997N124 @ DJ Cover@@@@oOtBbNX     
$!   1995N320  @Saar Maoz@@  쐬
$!
$!!!!!!!! ̃ZNV́CobNAbvvV[W̍\pɃ[U[ύX\
$ USER_PARAMETERS:
$  shutdown_immediate_wait = 20 ! IMMEDIATE[hŒ~܂ł
$!@@@@@@@@@@@@@@@@@@@@@@҂
$!
$! {XNvgPƂŎgpꍇ́C2s̃Rg邱ƁD
$! userpasswd := system/manager
$! mailuser = "SMAOZ"           ! [bZ[WKvłȂꍇ́C""ݒ
$!!!!!!!!
$!
$ set noon
$!
$! {XNvgŎgp郍[JȃV{
$!
$ say := write sys$output
$ wo := write outfile
$ delfile := delete/noconfirm/log
$ backupfile := backup/log/ignore=(interlock,nobackup)/new
$ sendmail := mail nl: 'mailuser' /subject=
$!
$! N@`FbN
$!
$ if p1 .eqs. "" then goto HELP
$ db_name = f$edit(p1,"UPCASE")
$!
$ if f$type(userpasswd) .eqs. "" .or. f$type(mailuser) .eqs. "" -
     then goto NO_SYMS
$!
$ say " "
$ say "ORACLE_UTILS:COLD_BACKUP.COM begins a cold backup on"+-
      " ''db_name' database at: "+f$time()
$ say " "
$!
$! ̐ݒ
$!
$ if f$trnlnm("oracle_utils") .eqs. "" then goto NO_LOGICAL
$ @oracle_utils:env_symbols  !PȂmF
$!
$! ̃R}hɂāCf[^x[XDORA_DB:ORAUSER_DBNAME.COM
$! sĐf[^x[X悤ȃf[^x[Xp̃V{CORACLE_UTILS:ENV_
$! SYMBOLS.COM̒Œ`ĂȂ΂ȂȂD
$!
$ 'db_name'
$ if .not. $status then goto NO_SYMBOL
$ show logical ora_sid
$ @oracle_utils:'db_name'_devices.com    ! gp\ȃobNAbv̊i[ꏊ̒`
$!
$! t@C̃obNAbvōs悤ɁCt@C̘_擾
$!
$ @ora_db:ora_db_'db_name'
$ if f$trnlnm("ora_control1") .eqs. "" then goto NO_CTL_LOGICALS
$!
$! gp\ŗLȃfoCX̃JEgifBXN̂݁j
$!
$ show log backup_location_*
$ device_cnt=1
$ DEV_LOOP:
$  if .not. f$getdvi("backup_location_''device_cnt'","EXISTS") -
      then goto DEV_VER  ! foCX݂邩mF
$  if f$getdvi("backup_location_''device_cnt'","DEVCLASS") .ne. 1 -
      then goto DEV_VER  ! foCXfBXNł邩mF
$  show device backup_location_'device_cnt'
$  device_cnt= device_cnt+1
$ goto DEV_LOOP
$!
$ DEV_VER:
$  device_cnt= device_cnt-1
$  if device_cnt .eq. 0 then goto NO_BACKUP_DEVICES  ! foCXȂꍇ
$!
$  say " "
$  say "ORACLE_UTILS:COLD_BACKUP.COM has recognized ''device_cnt' devices to"+-
     " use for backup."
$  say " "
$!
$! CX^XオĂ邩`FbND̏󋵂̏̂߂ɕۑ
$!
$ @oracle_utils:instance_up 'f$trnlnm("ora_sid")'
$ instance_was_up = instance_up
$ if instance_up
$ then
$! CX^X́CオĂꍇCR[hobNAbv̂߂ɒ~Kv
$  say " "
$  say "ORACLE_UTILS:COLD_BACKUP.COM"
$  say " The ''db_name' database is UP and must be shut down in order to"
$  say " perform a COLD backup."
$  say " "
$!
$! S[U[ɒʒmC10Ƀf[^x[XIMMEDIATE[hŒ~
$!
$   reply/node/all/urgent/bell -
  "Database ''db_name' shutting down in 10 minutes for backup. Please logout!"
$   say " "
$   say "ORACLE_UTILS:COLD_BACKUP.COM"
$   say " Now waiting 10 minutes before shutting down immediate"
$   say " "
$   wait 0:10:0.0
$   @oracle_utils:shutdown_immediate 'db_name'
$   wait 0:02:0.0
$   min = 2
$!
$! CX^XIMMEDIATE[hŒ~̂҂
$!
$   SHUTDOWN_WAIT:
$     @oracle_utils:instance_up 'f$trnlnm("ora_sid")'  ! オĂ邩
$!                                                       `FbN
$     if .not. instance_up then goto BRING_DB_UP
$     wait 0:05:0.0
$     min = min + 5
$     if min .ge. shutdown_immediate_wait then -
         goto SHUT_IMMED_TIMEOUT   ! ҂Ԃꍇ́CQĂ
$     goto SHUTDOWN_WAIT
$ endif
$!
$ BRING_DB_UP:
$!
$! 2̗RɂCf[^x[XRESTRICT[hŋND
$! 1. f[^t@CREDOÕXgt@C擾D
$! 2. R[hobNAbv𐳏ɍs߂ɁCDBNORMAL[hŒ~D
$! ̂悤ɂĂ΁CNORMAL[hŒ~DB̃obNAbvsƂ
$! łD
$!
$ say " "
$ say "ORACLE_UTILS:COLD_BACKUP.COM"
$ say " Bringing ''db_name' database up to get the list of datafiles/redologs"
$ say " and also to make sure it is shut down normal before this backup"
$ say " "
$ @oracle_utils:startup_dbamode 'db_name'
$!
$! \̈/f[^t@C̃Xgt@C̐Ƌt@C̍폜
$!
$ if f$search("backup_location_1:tbs_to_datafiles.lis") .nes. "" -
     then delfile/nolog backup_location_1:tbs_to_datafiles.lis;*
$ sqlplus -s 'userpasswd'  @oracle_utils:tbs_logfiles.sql
$!
$ say " "
$ say "ORACLE_UTILS:COLD_BACKUP.COM"
$ say " Shutting down ''db_name' database now for cold backup"
$ say " "
$ @ora_db:shutdown_'db_name'   ! R[hobNAbv̂߂ɁCNORMAL[hŒ~.
$!
$! \̈/f[^t@C̃Xgt@C̃I[vD̃t@C݂Ȃꍇ́CQ
$! ĂD
$!
$ close/nolog infile
$ open/read/error=OPEN_TBS_ERROR infile
  backup_location_1:tbs_to_datafiles.lis
$ read/end=EMPTY_TBS_LIST infile rec  ! t@C̐擪siRgjXLbv
$!
$ say "ORACLE_UTILS:COLD_BACKUP.COM is now deleting previous backup files"
$ say "  on all devices with the name BACKUP_LOCATION_*"
$ say " "
$ dev_cnt=1
$ DELETE_YESTERDAYS_BCK:
$!
$ delfile backup_location_'dev_cnt':*.*.* - ! 쐬΂̕\̈/f[^t@C
          /exclude=(*.lis.*,*.dmp.*)     ! ̃Xgt@CGNX|[gt@C
$!                                       ! 폜Ȃ
$ dev_cnt=dev_cnt+1
$ if dev_cnt .lt. device_cnt then goto  DELETE_YESTERDAYS_BCK
$!
$! ̃obNAbv烊XgAsƂɎgpRESTORE_DATABASE.COM
$! 쐬Jn
$!
$ close/nolog outfile
$ open/write outfile backup_location_1:restore_database.com
$ wo "$!FILE: backup_location_1:restore_database.com"
$ wo "$!Dynamically created by ORACLE_UTILS:COLD_BACKUP.COM at: "+-
        f$time()
$ wo "$!"
$ wo "$ type sys$input"
$ wo "  This script will restore all database files from their backup location"
$ wo "  to their location on production environment. It will first delete   
  the"
$ wo "  database file if it exists in the production envrionment and then will"
$ wo "  copy a backup of that file to that location. The same will be done to"
$ wo "  restore all the logfiles."
$ wo "  After that it will copy all the controlfiles to their location in"
$ wo "  the same fashion (deleting the production ones first)."
$ wo " "
$ wo "  This script should be run only if you plan to restore a database"
$ wo "  from a COLD backup."
$ wo "  To invoke this script edit it and remove the EXIT statement following"
$ wo "  this notice"
$ wo "$!"
$ wo "$ EXIT"
$ wo "$!"
$ wo "$ db_name := ''db_name'"
$ wo "$ if f$trnlnm(""oracle_utils"") .eqs. """" then goto NO_LOGICAL"
$ wo "$ @oracle_utils:env_symbols"
$ wo "$ ''''db_name''''"
$ wo "$ @ora_db:ora_db_''''db_name'''' ! to get ora_control* logicals"
$ wo "$ if f$trnlnm(""ora_control1"") .eqs. """" then goto NO_CTL_LOGICALS"
$ wo "$!"
$ wo "$ @oracle_utils:instance_up ''''f$trnlnm(""ora_sid"")'''' ! is db up?"
$ wo "$ if instance_up then goto INSTANCE_UP"
$ wo "$!"
$ wo "$ @oracle_utils:''db_name'_devices  ! define available backup devices"
$ wo "$!"
$ wo "$ set noon"
$ wo "$!"
$ wo "$ delfile := ''delfile'"
$ wo "$ backupfile := ''backupfile'"
$ wo "$!"
$ close/nolog outfile
$!
$! f[^t@C̃Xgt@C̏ƑS\̈̃obNAbv
$!
$ prv_tbs = ""
$LOOP:
$ read/end=END_INFILE_ERROR infile rec
$ tbs = f$element(0,"|",rec)             ! extract tablespace name
$!
$! \̈́COuN̏ꍇOt@Cł邽߁CY鏈֐iށD
$!
$ if f$edit(tbs,"compress") .eqs. " " then goto BACKUP_LOGFILES
$!
$! uVv\̈̏ꍇ́Cۑ邽߂̃XNvgĂяo
$!
$ if tbs .nes. prv_tbs then -
  @oracle_utils:backup_tablespace 'tbs' 'db_name' 'device_cnt'
$ prv_tbs = tbs
$ goto LOOP
$!
$ BACKUP_LOGFILES:
$  open/append outfile backup_location_1:restore_database.com
$  wo "$! Restore all logfiles by first deleting originals and then"
$  wo "$! copying the saved files into the production environment."
$  wo "$!"
$!
$ LOG_LOOP:
$  file = f$element(1,"|",rec)          ! t@Cdl𒊏o
$  size = f$element(2,"|",rec)          ! t@C̃TCY𒊏o
$!
$! t@C̃obNAbvsƂʒm
$!
$  say " "
$  say "Attempting to back up ''file'"
$  dev_cnt = 1
$  FIND_DEVICE_LOOP:
$!
$!   YfBXNɗ̈͏\邩D̏ꍇ́C󂫃ubN2000cĂ
$!   ilocation_1𖞔tɂȂƂdvjD
$!
$    if f$getdvi("backup_location_''dev_cnt'","FREEBLOCKS") - 2000 .gt. size
$    then
$      say "                  to "+f$trnlnm("backup_location_''dev_cnt'")
$      say " "
$      backupfile 'file'; backup_location_'dev_cnt':/by=original
$      st = $status
$      if st .eq. %X10A38410 then goto BACKUP_OK  ! ݗpɃI[v
$      if .not. st then goto BACKUP_ERROR         ! obNAbvɊւ邻̑
$!                                                  ̃G[
$!
$      BACKUP_OK:
$!
$!      쐬t@C̃tl[擾D́CRs[΂̃t@C̃o[W
$!      ԍ擾邽߁D̏ꍇ́CÕt@C݂ĂD
$!
$       fname=f$parse(file,,,"NAME")+f$parse(file,,,"TYPE")
$       full_name=f$search("backup_location_''dev_cnt':''fname'")
$!
$!      YREDOOXgA邽߂̃R}h쐬
$!
$       wo "$ if f$search(""''file'"") -"
$       wo " .nes. """" then -"
$       wo "       delfile ''file';"
$       wo "$ backupfile   ''full_name' -"
$       wo "               ''file'/by=original"
$       wo "$!"
$    else
$      dev_cnt = dev_cnt + 1                          ! ̃foCXɃXLbv
$      if dev_cnt .gt. device_cnt then goto NO_SPACE  ! ǂ̃foCXɂ̈悪
$                                                       Ȃ
$      goto FIND_DEVICE_LOOP
$    endif
$  read/end=COPY_CONTROLFILES infile rec    ! REDOÕRs[̊
$  goto LOG_LOOP
$!
$ COPY_CONTROLFILES:
$!
$ close/nolog infile     ! ̃t@C͂sv
$!
$! KvȂ̂́C1̐t@C
$!
$ backupfile ora_control1 -
             backup_location_1:ora_control_'db_name'.con/by=original
$ st = $status
$ if st .eq. %X10A38410 then goto COPY_PARAMS   ! ݗpɃI[v
$ if .not. st then goto BACKUP_ERROR            ! obNAbvɊւ邻̑
$!                                                G[
$!
$ COPY_PARAMS:
$!
$! INIT.ORA<nodename>_<SID>_INIT.ORǍƃobNAbv
$!
$ initora=f$parse("ora_params",,,"device")+-    ! init.oráCora_db:̒
          f$parse("ora_params",,,"directory")   ! ȂƁCi[ꏊs
$ initora=f$search(initora+"init.ora")
$ backupfile ora_params:;,'initora'-
             backup_location_1:/by=original
$ st = $status
$ if .not. st then goto BACKUP_ERROR         ! obNAbvɊւ鉽炩̃G[
$!
$! t@CׂăXgA邽߂̃R}h̍쐬ƃXgAt@Cւ̍ŏIIȏ̏
$! 
$!
$ wo "$!"
$ wo "$! Now restore all control files"
$ wo "$!"
$ wo "$ cnt=1"
$ wo "$ REPLACE_CTL:"
$ wo "$ backupfile backup_location_1:ora_control_''''db_name''''.con; -"
$ wo "             ora_control''''cnt''''/by=original"
$ wo "$ cnt=cnt+1"
$ wo "$!"
$ wo "$ if f$trnlnm(""ora_control""+f$string(cnt)) .nes. """" then "+-
      "goto REPLACE_CTL"
$ wo "$!"
$ wo "$ type sys$input"
$ wo " Restoration of datafiles, logfiles and control files of database"+-
      " ''db_name'"
$ wo " has been completed. Please review the logfile or screen for any errors."
$ wo " Since this restore was from a COLD backup, you can proceed to startup"
$ wo " the database."
$ wo " Please note that the parameter files INIT.ORA and <node>_<SID>_INIT.ORA"
$ wo " were not restored, although they have been originally backed up."
$ wo " If you wish to restore them, please do so manually."
$ wo " "
$ wo "  Good Luck!"
$ wo "$ goto FINISH"
$ wo "$!"
$ wo "$ INSTANCE_UP:"
$ wo "$ type sys$input"
$ wo "ERROR ** BACKUP_LOCATION_1:RESTORE_DATABASE.COM **"
$ wo "  The database is UP.  One or more processes belonging to this database"
$ wo "  is still running.  This script should be run when the database is"
$ wo "  DOWN.  Make sure the database is down, if necessary, issue a SHUTDOWN"
$ wo "  ABORT and rerun this script to restore a backup of the database."
$ wo "$ goto FINISH"
$ wo "$!"
$ wo "$ NO_LOGICAL:"
$ wo "$ type sys$input"
$ wo "ERROR ** BACKUP_LOCATION_1:RESTORE_DATABASE.COM **"
$ wo " The logical name ORACLE_UTILS is not defined. Please define it to point"
$ wo " to the directory where all the backup scripts reside."
$ wo "$ goto FINISH"
$ wo "$!"
$ wo "$ NO_CTL_LOGICALS:"
$ wo "$ type sys$input"
$ wo "ERROR ** BACKUP_LOCATION_1:RESTORE_DATABASE.COM **"
$ wo "  Can't find the controlfiles logicals (ORA_CONTROL*)"
$ wo "  They are usually defined in ORA_DB:ORA_DB_''db_name'.COM, and not"
$ wo "  hardcoded as controlfile names in the init.ora file"
$ wo "$ goto FINISH"
$ wo "$!"
$ wo "$ FINISH:"
$ wo "$ Exit"
$ close/nolog outfile
$!
$ say " "
$ say "ORACLE_UTILS:COLD_BACKUP.COM finished a cold backup on"+-
      " ''db_name' database at: "+f$time()
$ say " "
$ if mailuser .nes. "" then sendmail -
  "COLD backup operation for ''db_name' database completed at: ''f$time()'"
$!
$! f[^x[XƂƗオĂꍇ́Cf[^x[XēxNďI
$!
$ if instance_was_up
$ then
$  say " "
$  say "ORACLE_UTILS:COLD_BACKUP.COM"
$  say " The database was up when COLD backup started, so bringing it back up"
$  say " "
$  @ora_db:startup_exclusive_'db_name'
$ endif
$ goto FINISH
$!
$! G[ZNV
$!  {XNvg̈ȍ~́̕CG[p̃[`łDG[bZ[Wo͂
$!  тɁCMAIL_FINISHiE-mail𑗐MjFINISHiE-mail𑗐MȂjɕ򂷂D
$!  ftHǵCE-mailMD[ŃbZ[W𑗐MȂꍇ́CY
$!  xύX邱ƁD
$!
$ NO_SYMS:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " The local symbols userpasswd or mailuser are not defined."
$  say " This usually means that the script was called independently and the"
$  say " USER_PARAMETERS section of the script was not updated."
$  say " "
$  goto FINISH
$!
$ NO_LOGICAL:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " The logical name ORACLE_UTILS is not defined. Please define it to"
$  say " point to the directory where all the backup scripts reside."
$  goto MAIL_FINISH
$!
$ NO_SYMBOL:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " a. No symbol found with the database name that runs the"
$  say "    ORAUSER_<dbname>.COM, which will point us to the right database;"
$  say "    add it to ORACLE_UTILS:ENV_SYMBOLS.COM"
$  say " b. Some other error has occured while attempting to run the"
$  say "    ORAUSER_<dbname>.COM file; check the preceding VMS error message"
$  goto MAIL_FINISH
$!
$ NO_CTL_LOGICALS:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " Can't find the controlfiles logicals (ORA_CONTROL*)"
$  say " They are usually defined in ORA_DB:ORA_DB_''db_name'.COM, and not"
$  say " hardcoded as controlfile names in the init.ora file"
$  goto MAIL_FINISH
$!
$ NO_BACKUP_DEVICES:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " No backup locations with the name BACKUP_LOCATION_* found."
$  say " Please define some backup locations in ''db_name'_DEVICES.COM"
$  say " and verify that the devices exist."
$  goto MAIL_FINISH
$!
$ SHUT_IMMED_TIMEOUT:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " Waited for instance "+f$trnlnm("ora_sid")+" to shutdown immediate for"
$  say " ''min' minutes, but instance has not shutdown yet."
$  goto MAIL_FINISH
$!
$ BACKUP_ERROR:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " Received a VMS backup error final error code: ''st'"
$  say " Text: "+f$message(st)
$  goto MAIL_FINISH
$!
$ NO_SPACE:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " Not enough space for ''file'"
$  say " on any backup device. please assign more backup devices or clear some"
$  say " space on existing ones"
$  goto MAIL_FINISH
$!
$ OPEN_TBS_ERROR:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " An error has occured opening the tablespace datafiles mapping file."
$  say " It is located in BACKUP_LOCATION_1:TBS_TO_DATAFILES.LIS."
$  say " Please verify that the location is a valid directory owned by Oracle"
$  say " or the person running this script.  Also make sure that the Oracle"
$  say " shareable images are installed using ORA_RDBMS:INSORACLE.COM, which"
$  say " is required to run sqlplus."
$  goto MAIL_FINISH
$!
$ EMPTY_TBS_LIST:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " Found tablespace listings file empty"+-
$      " (BACKUP_LOCATION_1:TBS_TO_DATAFILES.LIS)"
$  goto MAIL_FINISH
$!
$ END_INFILE_ERROR:
$  say " "
$  say "ERROR ** ORACLE_UTILS:COLD_BACKUP.COM **"
$  say " Unexpected end of file BACKUP_LOCATION_1:TBS_LOGFILES.LIS"
$  say " The file is created by this script, and contains all the tablespaces"
$  say " names and their associated files, followed by the logfile names."
$  say " The first argument of a logfile record should be blank."
$  goto MAIL_FINISH
$!
$ HELP:
$  say " "
$  say "Usage of ORACLE_UTILS:COLD_BACKUP.COM is:"
$  say " @ORACLE_UTILS:COLD_BACKUP <db_name>"
$  goto FINISH
$!
$ MAIL_FINISH:
$  if mailuser .eqs. "" then goto FINISH
$!
$! Θb^[hƃob`[ĥǂœ삵Ă邩ɉāC[𑗐MD
$!
$  msg = "COLD backup procedure run in interactive mode failed"
$  if f$mode() .eqs. "BATCH" then msg = "COLD backup procedure terminated"+-
         " with errors check ''logfile'_''db_name'.log for details"
$  sendmail "''msg'"
$  goto FINISH
$!
$ FINISH:
$  close/nolog infile
$  close/nolog outfile
$  vvv = 'f$verify(vvv)'
$  exit


p.160-164
$!
$!
$!
$ vvv = 'f$verify(0)'  ! unoverifyvw肵C؂̎w𖳌ɂ
$! t@C:   ORACLE_UTILS:BACKUP_TABLESPACE.COM
$!
$!           by: Saar Maoz, Oracle Worldwide Support
$!
$! ړI:      \̈Ɋ֘Af[^t@CׂČC̃t@C̃obNAbv 
$!           sD
$! N@:   @oracle_utils:backup_tablespace tbs db_name num_of_devs
$!
$!          : @oracle_utils:backup_tablespace SYSTEM TESTDB 6
$!
$! p[^:
$!          P1: obNAbv̑ΏۂƂȂ\̈
$!          P2: \̈悪f[^x[X̖O
$!          P3: gp\ȃobNAbvpfoCX̌
$!
$! {vV[WĂяovV[W:   Ȃ
$!
$! {vV[W̌Ăяo: 
$!            oracle_utils:cold_backup
$!            oracle_utils:hot_backup
$!
$! :  V{:Ȃ
$!        _:  ORACLE_UTILŚCobNAbvXNvgׂĊi[
$!                 fBNgĂ邱ƁD
$!        t@C:backup_location_1:tbs_to_datafiles.lisobNAbv 
$!                 ̑ΏۂƂȂ\̈/f[^t@C
$!
$! o:  V{:Ȃ
$!        _:  Ȃ
$!        t@C: * backup_location_1:restore_database.com
$!                 ́CIɍ쐬DCLXNvgłCYobNAbv
$!                 ̃XgAsD܂CR[hƃzbĝǂ̃obNAb
$!                 vɂĊYt@C쐬ꂽD
$!
$!             * e\̈̈Ãf[^t@C̃obNAbv́CobNAbvpfoCX
$!               1Ɋi[D
$!
$! :
$!   t            O           Rg
$!   1995N320  Saar Maoz     쐬
$!
$ set noon
$!
$! {XNvgŎgp郍[JȃV{
$!
$ say := write sys$output
$ wo := write outfile
$ delfile := delete/noconfirm/log
$ backupfile := backup/log/ignore=(interlock,nobackup)/new
$!
$! N@`FbN
$!
$ if p1 .eqs. "" then goto HELP
$!
$ tbs_to_copy = p1
$ db_name = p2
$ device_cnt = p3
$!
$! \̈/f[^t@C̃Xgt@C̃I[vDYt@C݂Ȃꍇ͉炩
$! QĂD
$!
$ close/nolog infile2
$ open/read/error=OPEN_TBS_ERROR infile2 backup_location_1:tbs_to_datafiles.lis
$ read/end=EMPTY_FILE infile2 rec  ! t@C̐擪R[hiRgjXLbv
$!
$! YobNAbv烊XgAsƂɎgp
$!RESTORE_DATABASE.COMɃR}hǉ
$!
$ close/nolog outfile
$ open/append outfile backup_location_1:restore_database.com
$!
$ wo "$! Restore all files of tablespace ''tbs_to_copy' by first deleting"
$ wo "$! originals and then copying the saved files to the production"
$ wo "$! environment."
$ wo "$!"
$!
$! Y\̈̈Ãt@C𒲍
$!
$ MAIN_LOOP:
$   read/end=CLOSE_FILES infile2 rec
$   tbs = f$element(0,"|",rec)           ! \̖̈O𒊏o
$   if tbs .nes. tbs_to_copy then goto MAIN_LOOP
$!
$!  Rs[ׂt@C̂ŁCx͊YfBXNT
$!
$   file = f$element(1,"|",rec)          ! t@C̎dl𒊏o
$   size = f$element(2,"|",rec)          ! t@C̃TCY𒊏o
$!
$! t@C̃obNAbvsƂʒm
$!
$   say " "
$   say "Attempting to backup ''file'"
$   dev_cnt = 1
$   FIND_DEVICE_LOOP:
$!
$!    YfBXNɗ̈͏\邩D̏ꍇ́C󂫃ubN2000cĂ
$!    ilocation_1𖞔tɂȂƂdvjD
$!
$     if f$getdvi("backup_location_''dev_cnt'","FREEBLOCKS") - 2000 .gt. size
$     then
$       say "                  to "+f$trnlnm("backup_location_''dev_cnt'")
$       say " "
$       backupfile 'file'; backup_location_'dev_cnt':/by=original
$       st = $status
$       if st .eq. %X10A38410 then goto BACKUP_OK  ! ݗpɃI[v
$       if .not. st then goto BACKUP_ERROR
$!
$      BACKUP_OK:
$!
$!  쐬t@C̃tl[擾D́CRs[΂̃t@C̃o[W
$!  ԍ擾邽߁D̏ꍇ́CÕt@C݂ĂD
$!
$       fname=f$parse(file,,,"NAME")+f$parse(file,,,"TYPE")
$       full_name=f$search("backup_location_''dev_cnt':''fname'")
$!
$!      Yf[^t@CXgA邽߂̃R}h쐬
$!
$       wo "$ if f$search(""''file'"") -"
$       wo "  .nes. """" then -"
$       wo "       delfile ''file';"
$       wo "$ backupfile   ''full_name' -"
$       wo "               ''file'/by=original"
$       wo "$!"
$       goto MAIN_LOOP
$     endif
$     dev_cnt = dev_cnt + 1                          ! ̃foCXXLbv
$     if dev_cnt .gt. device_cnt then goto NO_SPACE  ! ǂ̃foCXɂ̈
$!                                                     Ȃ
$     goto FIND_DEVICE_LOOP
$!
$ CLOSE_FILES:
$ close/nolog infile2
$ close/nolog outfile
$!
$ goto FINISH   !Done
$!
$! G[ZNV
$!  {XNvg̈ȍ~́̕CG[p̃[`łDG[bZ[Wo͂
$!  тɁCMAIL_STOPisIE-mail𑗐Mjɕ򂷂D̃XNvg
$!  I邩ǂ͂̃XNvgɂĂ邽߁C̃[`I邱ƂdvD
$!
$ OPEN_TBS_ERROR:
$  say " "
$  say "ERROR ** ORACLE_UTILS:BACKUP_TABLESPACE.COM **"
$  say " An error has occured opening the tablespace datafiles mapping file."
$  say " It's located in BACKUP_LOCATION_1:TBS_TO_DATAFILES.LIS"
$  say " Please verify that the location is a valid directory owned by Oracle"
$  say " or the person running this script.  Also make sure that the Oracle"
$  say " shareable images are installed using ORA_RDBMS:INSORACLE.COM which"
$  say " is required to run sqlplus"
$  goto MAIL_STOP
$!
$ EMPTY_FILE:
$  say " "
$  say "ERROR ** ORACLE_UTILS:BACKUP_TABLESPACE.COM **"
$  say " Tablespace datafiles mapping file is empty.  The file is created by"
$  say " ORACLE_UTILS:HOT/COLD_BACKUP.COM which calls"
$  say " ORACLE_UTILS:TBS_TO_DATAFILES.SQL or ORACLE_UTILS:TBS_LOGFILES.SQL"
$  say " respectively."
$  goto MAIL_STOP
$!
$ BACKUP_ERROR:
$  say " "
$  say "ERROR ** ORACLE_UTILS:BACKUP_TABLESPACE.COM **"
$  say " Received a VMS backup error final error code: ''st'"
$  say " Text: "+f$message(st)
$  goto MAIL_STOP
$!
$ NO_SPACE:
$  say " "
$  say "ERROR ** ORACLE_UTILS:BACKUP_TABLESPACE.COM **"
$  say " Not enough space for ''file'"
$  say " on any backup device. Please assign more backup devices or clear some"
$  say " space on existing ones."
$  goto MAIL_STOP
$!
$ HELP:
$  say " "
$  say "Usage of ORACLE_UTILS:BACKUP_TABLESPACE.COM is:"
$  say " @ORACLE_UTILS:BACKUP_TABLESPACE.COM <tbsname> <db_name> <num_devs>"
$  say " look in ORACLE_UTILS:HOT/COLD_BACKUP for correct usage"
$  goto FINISH
$!
$ MAIL_STOP:
$  if mailuser .nes. "" then  sendmail -
     "Backup procedure terminated with error check logfile for details"
$!
$  STOP ! dȃG[߁C{XNvgі{XNvgĂяoĂ邷ׂĂ
$!        XNvgI
$!
$ FINISH:
$  vvv = 'f$verify(vvv)'


p.165-166
$!
$!
$!
$! t@C: ORACLE_UTILS:INSTANCE_UP.COM
$!         by: Saar Maoz, Oracle Worldwide Support
$! ړI:    obNOEhvZX̂ǂꂪғĂ邩`FbND
$! N@: @oracle_utils:instance_up SID
$!         : @oracle_utils:instance_up TEST
$!
$! p[^:
$!         P1 CX^X̃VXeIDiSIDj
$!
$! {vV[WĂяovV[W:   Ȃ
$!
$! {vV[W̌Ăяo: 
$!            oracle_utils:cold_backup
$!            oracle_utils:hot_backup
$!            oracle_utils:export_database
$!
$! : V{ : Ȃ
$!       _ :   Ȃ
$!       t@C:  Ȃ
$!
$! o: V{:  instance_upi1:ғC0:~j
$!       _:    Ȃ
$!       t@C:  Ȃ
$!
$! :
$!   t            O           Rg
$!   1995N320  Saar Maoz     쐬
$!
$ set noon
$!
$! N@`FbN
$!
$ if p1 .eqs. "" then goto HELP
$ sid = p1
$!
$ instance_up == 1
$ ctx = ""
$!
$! Ym[hORA_sid_*Ƃ悤ȖOvZXD̂悤ȃvZX́C
$! YCX^XɏĂobNOEhvZXłD
$!
$ tmp = f$context("PROCESS",ctx,"NODENAME","''f$getsyi("nodename")'","EQL")
$ tmp = f$context("PROCESS",ctx,"PRCNAM","ORA_''sid'_*","EQL")
$ pid = f$pid(ctx)
$ if pid .eqs. "" then instance_up == 0
$ goto FINISH
$!
$ HELP:
$  say " "
$  say "Usage of ORACLE_UTILS:INSTANCE_UP.COM is:"
$  say " @ORACLE_UTILS:INSTANCE_UP SID"
$  goto FINISH
$!
$ FINISH:
$  exit


p.166-167
$!
$!
$!
$! t@C:       ORACLE_UTILS:ENV_SYMBOLS.COM
$!                 by: Saar Maoz, Oracle Worldwide Support
$! ړI:           ef[^x[Xp̃V{ZbgAbvD
$! N@:       @oracle_utils:env_symbols
$! p[^:     Ȃ
$! {vV[WĂяovV[W:   Ȃ
$!
$! {vV[W̌Ăяo: login.comsylogin.com]܂
$!
$! :           V{: Ȃ
$!                 _:   Ȃ
$!                 t@C: Ȃ
$!
$! o:           V{: db_name
$!                 _:   Ȃ
$!                 t@C: Ȃ
$!
$! :
$!   t            O           Rg
$!   1995N320   Saar Maoz      쐬
$!
$ set noon
$!
$! Ym[h̃f[^x[XƂɁCV{̂悤ɃZbgAbvD
$!
$! dbname :== @location_of_orauser_file.com
$!
$! :
$!
$! testdb :== @sys$sysdevice:[oracle7.root71.db_testdb]orauser_testdb
$!
$ Exit


p.167-170
$!
$!
$!
$! t@C:     ORACLE_UTILS:SHUTDOWN_IMMEDIATE.COM
$!             by: Saar Maoz, Oracle Worldwide Support
$! ړI:        f[^x[XIMMEDIATE[hŒ~D
$! N@:     @oracle_utils:shutdown_immediate db_name
$!             : @oracle_utils:shutdown_immediate TESTDB
$!
$! p[^:
$!          P1: f[^x[X̖O
$!
$! {vV[WĂяovV[W:  ora_db:ora_db_'db_name'.com
$!          oracle_utils:shutdown_immediate_'db_name'.com
$!           |->oracle_utils:shutdown_immediate_'db_name'.sql
$!
$! {vV[W̌Ăяo: oracle_utils:cold_backup
$!
$! :      V{:  Ȃ
$!            _:    ORACLE_UTILŚCobNAbvXNvgׂĊi[ĂfB
$!                       NgĂ邱ƁD
$!                       ORA_PARAMŚCora_db:ora_db_db_name.comɂĒ`
$!                       node_SID_INIT.ORAt@CĂ邱ƁD
$!            t@C:  Ȃ
$!
$! o:      V{:  Ȃ
$!            _:    Ȃ
$!            t@C:  * oracle_utils:shutdown_immediate_db_name.sql
$!                         f[^x[X̒~ɕKvServer Manager̃R}h
$!                         i[CIɍ쐬XNvgD
$!                       * oracle_utils:shutdown_immediate_db_name.com
$!                         Iɍ쐬DCLXNvgłC̃XNvg̓f[^x[X
$!                         ~邽߂̑OL̃t@CServer Manager̒ɓĂ
$!                         ĂяoD
$!
$! :
$!   t            O           Rg
$!   1997N124   DJ Cover       SQLDBASVRMGRLɕύX
$!   1995N320   Saar Maoz      쐬
$!
$ set noon
$!
$! {XNvgŎgp郍[JȃV{
$!
$ say := write sys$output
$ wo := write outfile
$ wo2 := write outfile2
$!
$! N@`FbN
$!
$ if p1 .eqs. "" then goto HELP
$ db_name = p1
$ @ora_db:ora_db_'db_name'           ! ora_params̘_IȃobNAbvs
$ if f$trnlnm("ora_params") .eqs. "" then goto NO_PARAM_FILE
$!
$! Op[W
$!
$ if f$search("oracle_utils:shutdown_immediate_''db_name'.*") .nes. "" then -
   purge/nolog/keep=3 oracle_utils:shutdown_immediate_'db_name'.*
$!
$! ~ۂɎs邽߂DCLXNvgSQLXNvg쐬
$!
$ close/nolog outfile
$ close/nolog outfile2
$ open/write outfile oracle_utils:shutdown_immediate_'db_name'.com
$ open/write outfile2 oracle_utils:shutdown_immediate_'db_name'.sql
$!
$ wo "$!Dynamically created by ORACLE_UTILS:SHUTDOWN_IMMEDIATE.COM at: "+-
     f$time()
$ wo "$!This script will go into sqldba and call a SQL script that will "
$ wo "$! shut down the ''db_name' database with the immediate option"
$ wo "$!"
$ wo "$ SVRMGRL
$ wo "@oracle_utils:shutdown_immediate_''db_name'"
$ wo "exit"
$ wo "$exit"
$ close/nolog outfile
$!
$ wo2 "rem Dynamically created by ORACLE_UTILS:SHUTDOWN_IMMEDIATE.COM at: "+-
      f$time()
$ wo2 "rem This script issues the SQL statements to shutdown the ''db_name'"
$ wo2 "rem database with the immediate option"
$ wo2 "set echo on"
$ wo2 "connect internal"
$ wo2 "shutdown immediate"
$ close/nolog outfile2
$!
$! 쐬XNvgif[^x[XIMMEDIATE[hŒ~js
$!
$ @oracle_utils:shutdown_immediate_'db_name'.com
$ goto FINISH
$!
$ NO_PARAM_FILE:
$  say " "
$  say "ERROR ** ORACLE_UTILS:SHUTDOWN_IMMEDIATE.COM **"
$  say " The logical name ORA_PARAMS which points to the init.ora file of"
$  say " this ("+f$trnlnm(""ora_sid"")+") instance is not defined. The usual"
$  say " place where this logical is defined is ora_db:ora_db_''db_name'.com"
$  say " Please check why this logical was not defined and rerun this script."
$  goto FINISH
$!
$ HELP:
$  say " "
$  say "Usage of ORACLE_UTILS:SHUTDOWN_IMMEDIATE.COM is:"
$  say " @ORACLE_UTILS:SHUTDOWN_IMMEDIATE <db_name>"
$  goto FINISH
$!
$ FINISH:
$  Exit


p.170-172
$!
$!
$! t@C:  ORACLE_UTILS:STARTUP_DBAMODE.COM
$!            by: Saar Maoz, Oracle Worldwide Support
$! ړI:      f[^x[XRESTRICT[hiDBA[hjŋND
$! N@:  @oracle_utils:startup_dbamode db_name
$!            : @oracle_utils:startup_dbamode TESTDB
$!
$! p[^:
$!          P1: f[^x[X̖O
$!
$! {vV[WĂяovV[W:  ora_db:ora_db_'db_name'.com
$!          oracle_utils:startup_dbamode_'db_name'.com
$!          |->oracle_utils:startup_dbamode_'db_name'.sql
$!
$! {vV[W̌Ăяo:
$!          oracle_utils:cold_backup
$!          oracle_utils:export_database
$!
$! :    V{:   Ȃ
$!          _:     ORACLE_UTILŚCobNAbvXNvgׂĊi[
$!                      ĂfBNgĂ邱ƁDORA_PARAMŚC
$!                      ora_db:ora_db_db_name.comɂĒ`Ă
$!                      node_SID_INIT.ORAt@CĂ邱ƁD
$!          t@C:   Ȃ
$!
$! o:    V{:   Ȃ
$!          _:     Ȃ
$!          t@C: * oracle_utils:startup_dbamode_db_name.sql
$!                    f[^x[XRESTRICT[hŋN̂ɕKvServer 
$!                    Manager̃R}hi[CIɍ쐬XNvgD
$!                    * oracle_utils:startup_dbamode_db_name.com
$!                    Iɍ쐬DCLXNvgłC̃XNvg
$!                    f[^x[XRESTRICT[hŋN邽߂̏L
$!                    t@CServer Manager̒ɓĂĂяoD
$!
$! :
$!   t            O           Rg
$!   1997N1N24   DJ Cover       SQLDBASVRMGRLɕύX
$!   1995N320   Saar Maoz      쐬
$!
$ set noon
$!
$! {XNvgŎgp郍[JȃV{
$!
$ say := write sys$output
$ wo := write outfile
$ wo2 := write outfile2
$!
$! N@`FbN
$!
$ if p1 .eqs. "" then goto HELP
$ db_name = p1
$ @ora_db:ora_db_'db_name'                 ! ora_params̘_IȃobNAbv
$                                            s
$ if f$trnlnm("ora_params") .eqs. "" then goto NO_PARAM_FILE
$!
$! Op[W
$!
$ if f$search("oracle_utils:startup_dbamode_''db_name'.*") .nes. "" then -
   purge/nolog/keep=3 oracle_utils:startup_dbamode_'db_name'.*
$!
$! NۂɎs邽߂DCLXNvgSQLXNvg쐬
$!
$ close/nolog outfile
$ close/nolog outfile2
$ open/write outfile oracle_utils:startup_dbamode_'db_name'.com
$ open/write outfile2 oracle_utils:startup_dbamode_'db_name'.sql
$!
$ wo "$!Dynamically created by ORACLE_UTILS:STARTUP_DBAMODE.COM at: ''f$time()'"
$ wo "$!This script will go into SVRMGRL and call a SQL script that will start"
$ wo "$!the ''db_name' database in restricted mode"
$ wo "$!"
$ wo "$ SVRMGRL"
$ wo "@oracle_utils:startup_dbamode_''db_name'"
$ wo "exit"
$ wo "$exit"
$ close/nolog outfile
$!
$ wo2 "rem Dynamically created by ORACLE_UTILS:STARTUP_DBAMODE.COM at: "+-
      f$time()
$ wo2 "rem This script issues the SQL statements to startup the ''db_name'"
$ wo2 "rem database in restricted mode."
$ wo2 "set echo on"
$ wo2 "connect internal"
$ wo2 "startup restrict open ""''db_name'"""
$ close/nolog outfile2
$!
$! 쐬XNvgif[^x[XRESTRICT[hŋNjs
$!
$ @oracle_utils:startup_dbamode_'db_name'.com
$ goto FINISH
$!
$ NO_PARAM_FILE:
$  say " "
$  say "ERROR ** ORACLE_UTILS:STARTUP_DBAMODE.COM **"
$  say " The logical name ORA_PARAMS which points to the init.ora file of"
$  say " this ("+f$trnlnm(""ora_sid"")+") instance is not defined. The usual"
$  say " place where this logical is defined is ora_db:ora_db_''db_name'.com."
$  say " Please check why this logical was not defined and rerun this script."
$  goto FINISH
$!
$ HELP:
$  say " "
$  say "Usage of ORACLE_UTILS:STARTUP_DBAMODE.COM is:"
$  say " @ORACLE_UTILS:STARTUP_DBAMODE <db_name>"
$  goto FINISH
$!
$ FINISH:
$ Exit


p.173
$ submit oracle_utils:backup_main.com -
      /parameters=("TESTDB","COMPLETE","YES") -
      /after="23:00" -
      /log=sys$scratch:save_database_TESTDB.log -
      /queue=sys$batch -
      /retain=error -
      /noprint


$! :
$!   t         @@@O          Rg
$!   1997N124  @DJ Cover     obNAbv쐬ꏊ̘_def"/JOB"ǉ
$!   1995N320  @Saar Maoz    쐬
$!
$! fBXNŗLȃfBNgB̃GNX|[gƂĒ`
$!
$ define/nolog export_location userdisk1:[export_testdb]
$!
$! Cӂ̃obNAbvfBNg`
$!
$ define/nolog  backup_location_1  sys$sysdevice:[hot_backup_testdb]
$ define/nolog  backup_location_2  userdisk21:[hot_backup_testdb]
$ define/nolog  backup_location_3  userdisk33:[hot_backup_testdb]
$ define/nolog  backup_location_4  userdisk14:[hot_backup_testdb]
$ define/nolog  backup_location_5  userdisk5:[hot_backup_testdb]
$ define/nolog  backup_location_6  userdisk4:[hot_backup_testdb]


p.174
REM  DJ Cover/Saar Moaz   970124    added "set timing off"
set feedback off
set pagesize 0
set heading off
set echo off
set termout off
set timing off
spool backup_location_1:tbs_to_datafiles

SELECT '! Dynamically created by ORACLE_UTILS:COLD_BACKUP.COM at: '||
       to_char(sysdate,'dd-mon-yyyy hh:mi:ss')
FROM dual;


rem Yf[^x[Xׂ̂Ẵf[^t@C擾D


SELECT tablespace_name||'|'||file_name||'|'||ceil(bytes/512)
FROM   sys.dba_data_files
ORDER BY tablespace_name,bytes desc;


rem Get all the redo logs for this database


SELECT '  '||'|'||member||'|'||ceil(bytes/512)
FROM   v$log,v$logfile
WHERE  v$log.group# = v$logfile.group#;
spool off;


EXIT


p.174-175
REM  DJ Cover/Saar Moaz   970124    added "set timing off"
set feedback off
set pagesize 0
set heading off
set echo off
set termout off
set timing off
spool backup_location_1:tbs_to_datafiles

SELECT '! Dynamically created by ORACLE_UTILS:COLD_BACKUP.COM at: '||
       to_char(sysdate,'dd-mon-yyyy hh:mi:ss')
FROM dual;

rem Yf[^x[Xׂ̂Ẵf[^t@C擾D

SELECT tablespace_name||'|'||file_name||'|'||ceil(bytes/512)
FROM   sys.dba_data_files
ORDER BY tablespace_name,bytes desc;

rem Yf[^x[Xׂ̂ĂREDOO擾D

SELECT '  '||'|'||member||'|'||ceil(bytes/512)
FROM   v$log,v$logfile
WHERE  v$log.group# = v$logfile.group#;
spool off;

EXIT



p.175
rem A̕\̈悪obNAbv[hizbgobNAbv̑Oj
rem ɂ邩ǂDǂ̍sNOT ACTIVEƂĕ\D
select * from v$backup;
exit;


p.175-179
rem This will show if the tablespaces are in backup mode, done before and
rem after a hot backup.  All rows should show as NOT ACTIVE
select * from v$backup;
exit;
(2)Hot_Backup_Sample_Run.log
This is a sample run of a HOT backup. The reason why we are recognizing only 1 backup device is because the rest of the logicals 2 through 6 are of devices that do not exist. Also note that the "no strings matched" message at the end is normal, it means that the logs have been searched for errors and none were found.
ORACLE_UTILS:HOT_BACKUP.COM begins a hot backup on TESTDB database
                            at: 24-MAR-1995 23:00:32.29

%DCL-I-SUPERSEDE, previous value of ORA_SID has been superseded
   "ORA_SID" = "TEST" (LNM$PROCESS_TABLE)

(LNM$PROCESS_TABLE)

  "BACKUP_LOCATION_1" = "SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]"
  "BACKUP_LOCATION_2" = "USERDISK21:[HOT_BACKUP_TESTDB]"
  "BACKUP_LOCATION_3" = "USERDISK33:[HOT_BACKUP_TESTDB]"
  "BACKUP_LOCATION_4" = "USERDISK14:[HOT_BACKUP_TESTDB]"
  "BACKUP_LOCATION_5" = "USERDISK5:[HOT_BACKUP_TESTDB]"
  "BACKUP_LOCATION_6" = "USERDISK4:[HOT_BACKUP_TESTDB]"


Device            Device          Error    Volume         Free  Trans Mnt
 Name             Status          Count     Label        Blocks Count Cnt
MCAVMS$DKA0:      Mounted             0  AXPVMSSYS        90408   422   1

ORACLE_UTILS:HOT_BACKUP.COM has recognized 1 devices to use for backup.

ORACLE_UTILS:HOT_BACKUP.COM is now deleting previous backup files
 on all devices with the name BACKUP_LOCATION_*

%DELETE-I-FILDEL, SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ORA_CONTROL_TESTDB.CON;1 deleted (312 blocks)
%DELETE-I-FILDEL, SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ORA_DATA_1.DBS;4 deleted (2048 blocks)
%DELETE-I-FILDEL, SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ORA_DATA_2.DBS;4 deleted (2048 blocks)
%DELETE-I-FILDEL, SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ORA_SYSTEM.DBS;3 deleted (12288 blocks)
%DELETE-I-FILDEL, SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ORA_SYSTEM1.DBS;2 deleted (8192 blocks)
%DELETE-I-FILDEL, SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]RESTORE_DATABASE.COM;2  deleted (12 blocks)
%DELETE-I-FILDEL, SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]RESTORE_DATABASE.COM;1  deleted (12 blocks)
%DELETE-I-TOTAL, 7 files deleted (24912 blocks)

     FILE# STATUS             CHANGE#    TIME
---------- ------------------ ---------- --------------------
     1 NOT ACTIVE             7151       03/24/94 12:31:30
     2 NOT ACTIVE             7151       03/24/94 12:31:30
     3 NOT ACTIVE             7150       03/24/94 12:31:26
     4 NOT ACTIVE             7150       03/24/94 12:31:26

$ vvv = 0 ! Turn verify on so we can see commands in SVRMGRL
$ SVRMGRL

SVRMGRL: Release 7.1.3.2.0 - Production on Fri Mar 24 23:00:40 1995

Copyright (c) Oracle Corporation 1979, 1995.  All rights reserved.

Oracle7 Server Release 7.1.3.2.0 - Production Release
With the distributed, parallel query and Parallel Server options
PL/SQL Release 2.1.3.2.0 - Production

SVRMGRL>
connect internal
Connected.
SVRMGRL>
alter system archive log current;
Statement processed.
SVRMGRL>
  REM It is normal to get warning messages from backup in the form of
SVRMGRL>
  REM %BACKUP-W-ACCONFLICT, <file name> is open for write by another user
SVRMGRL>
spool backup_location_1:alter_tbs_begin_end.log
File SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ALTER_TBS_BEGIN_END.LOG opened
SVRMGRL>
alter tablespace SAAR begin backup;
Statement processed.
SVRMGRL>
spool off
File SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ALTER_TBS_BEGIN_END.LOG closed
SVRMGRL>
host @oracle_utils:backup_tablespace SAAR TESTDB 1

Attempting to backup DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]ORA_DATA_1.DBS
                  to SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]

%BACKUP-W-ACCONFLICT, DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]ORA_DATA_1.DBS;4
 is open for write by another user
%BACKUP-S-CREATED, created SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ORA_DATA_1.DBS;4

Attempting to backup DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]ORA_DATA_2.DBS
                  to SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]

%BACKUP-W-ACCONFLICT, DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]ORA_DATA_2.DBS;4
 is open for write by another user
%BACKUP-S-CREATED, created SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ORA_DATA_2.DBS;4
$  vvv = 0

SVRMGRL>
spool backup_location_1:alter_tbs_begin_end.log
File SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ALTER_TBS_BEGIN_END.LOG opened
SVRMGRL>
alter tablespace SAAR end backup;
Statement processed.
SVRMGRL>
spool off
File SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ALTER_TBS_BEGIN_END.LOG closed
SVRMGRL>
spool backup_location_1:alter_tbs_begin_end.log
File SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ALTER_TBS_BEGIN_END.LOG opened
SVRMGRL>
alter tablespace SYSTEM begin backup;
Statement processed.
SVRMGRL>
spool off
File SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ALTER_TBS_BEGIN_END.LOG closed
SVRMGRL>
host @oracle_utils:backup_tablespace SYSTEM TESTDB 1

Attempting to backup DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]ORA_SYSTEM.DBS
                  to SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]

%BACKUP-W-ACCONFLICT, DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]ORA_SYSTEM.DBS;3
 is open for write by another user
%BACKUP-S-CREATED, created SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ORA_SYSTEM.DBS;3

Attempting to backup DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]ORA_SYSTEM1.DBS
                  to SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]

%BACKUP-W-ACCONFLICT,
DISK$AXPVMSSYS:[ORACLE7.ROOT71.DB_TESTDB]ORA_SYSTEM1.DBS;2
 is open for write by another user
%BACKUP-S-CREATED, created SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ORA_SYSTEM1.DBS;2

SVRMGRL>
spool backup_location_1:alter_tbs_begin_end.log
File SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ALTER_TBS_BEGIN_END.LOG opened
SVRMGRL>
alter tablespace SYSTEM end backup;
Statement processed.
SVRMGRL>
spool off
File SYS$SYSDEVICE:[HOT_BACKUP_TESTDB]ALTER_TBS_BEGIN_END.LOG closed
SVRMGRL>
alter database backup controlfile to
'backup_location_1:ora_control_TESTDB.con';
Statement processed.
SVRMGRL>
exit


     FILE# STATUS             CHANGE#    TIME
---------- ------------------ ---------- --------------------
     1 NOT ACTIVE             7163       03/24/94 23:00:45
     2 NOT ACTIVE             7163       03/24/94 23:00:45
     3 NOT ACTIVE             7162       03/24/94 23:00:41
     4 NOT ACTIVE             7162       03/24/94 23:00:41

%SEARCH-I-NOMATCHES, no strings matched

ORACLE_UTILS:HOT_BACKUP.COM finished a hot backup on TESTDB database
                            at: 24-MAR-1995 23:01:03.15

Job BACKUP_MAIN (queue SYS$BATCH, entry 43) holding until 25-MAR-1995 23:01
  SMAOZ        job terminated at 24-MAR-1995 23:01:03.89

  Accounting information:
  Buffered I/O count:       1843         Peak working set size:  18096
  Direct I/O count:          643         Peak page file size:    73344
  Page faults:              3442         Mounted volumes:            0
  Charged CPU time:      0 00:00:04.43   Elapsed time:     0 00:00:33.19



p.180
REM ܂C\̈user_dataɏĂ邷ׂẴf[^t@C̃Xg擾D
REM SQL*FormsgCAJEgDBAOracleɐڑD
SQL> select file_id, tablespace_name, status, file_name from dba_data_files
2  where tablespace_name='USER_DATA';
FILE_ID   TABLESPACE_NAME   STATUS     FILE_NAME
--------- ----------------- ---------  ---------
2 USER_DATA                 AVAILABLE  C:\ORANT\DATABASE\USR1ORCL.ORA
3 USER_DATA                 AVAILABLE  C:\ORANT\DATABASE\USR2ORCL.ORA


REM x́C\̈user_dataItCɂD
SQL> alter tablespace user_data offline;
Tablespace altered.


C:\ORANT\DATABASE > backup usr1orcl.ora a:
C:\ORANT\DATABASE > backup usr2orcl.ora a:
SQL> alter tablespace user_data online;
Tablespace altered.


p.184-188
#! /bin/sh
#
# O     $TOOLS/backup/dbbackup
# C     97/11/4 Ravi Krishnamurthy
# :  ϐ$TOOLSɂ́CVXeǗp̃XNvgׂĊi[Ă
# fBNgݒ肷D
# ړI     f[^x[X̃obNAbvsD
# N@  $TOOLS/backup/dbbackup <dbname>
# p[^ $1=f[^x[X
#         {XNvǵC$TOOLS/db_admin/backup/common/crontab.envĂяoC
#         KvȊϐݒ肷D
#         {XNvǵCXPW[ɏ]āC$TOOLS/backup/dbbackup_begin܂
#         $TOOLS/backup/dbexport_beginĂяoD
#
# ..............................................................
# [JϐibZ[WG[ȂǂMO邽߂̃t@Cj̐ݒ
# ..............................................................
BEGIN_JOB="`date`"
ERRMSG="Usage: `basename $0` <dbname>"

if [ "$1" ]
then DBNAME=$1
else echo $ERRMSG
     exit
fi

LOGDIR="$TOOLS/db_admin/db_${DBNAME}/log"

LOGFILE="${LOGDIR}/backup_`date '+%y%m%d'`.log"
ERRFILE="${LOGDIR}/backup_`date '+%y%m%d'`.err"
ERRFILE2="${LOGDIR}/backup_`date '+%y%m%d'`_old.err"
MSGFILE="${LOGDIR}/backup_`date '+%y%m%d'`.msg"

#
# ..............................................................
# ̐ݒ
# ..............................................................

# ̍sŒ`:@ORACLE_HOMECORACLE_SIDCPATHCBACKUPDIR
# BACKUPDIROLD, EXPORTDIR, EXPORTDIROLD, ARCOLD
#
. $TOOLS/db_admin/common/crontab.env $DBNAME


# ADMIN_FILEt@ĆC̃f[^x[Xɑ΂ĊǗp̃R}hs
# ۂɎgpłD̂悤ȃ^XNł́Cinit<sid>.ora̒̃p[^
# ύX邩ȂD̍śCKvɉăRg邱ƁD
#
# ADMIN_FILE="$TOOLS/db_admin/db_$DBNAME/tools/${DBNAME}_backup_admin.sh"

#
# SCHED_FILÉCobNAbṽXPW[i[Ăt@CD
# t@C̒̍s͒ʏĈ悤ɂȂĂD
#
# V7PROD Sun hot export /V7PROD/db_management/restrict1.sh
#
# V7PROD̓f[^x[X̖OCSunSunday̗Chot̓obNAbṽ^CvC
# export͕tIȃobNAbvDŌ̃J́Cs̑ΏۂƂȂ
# ^XNiꕔ̃t@C̃N[AbvȂǁjłD
#
# JOBNAMÉC݂̃XNvgD
# DBBACKUP_BEGIŃCỸXPW[ɊÂăzbg܂̓R[h
# ̃obNAbvsobNAbvXNvgD
# DBEXPORT_BEGIŃCf[^x[XGNX|[g邽߂̃XNvgD
# dbbackup_begindbexport_begińC̃ZNVŎD
#


SCHED_FILE="$TOOLS/db_admin/common/dbbackup_sched.dat"
JOBNAME="$TOOLS/backup/dbbackup"
DBBACKUP_BEGIN="$TOOLS/backup/dbbackup_begin"
DBEXPORT_BEGIN="$TOOLS/backup/dbexport_begin"
TODAY="`date`"
THIS_DAY="`date '+%a'`"
MSG="$DBNAME Backup succeeded at `date`"

# HP-UXقƂǂ̃vbgtH[ł́C̍snawkƂ邱ƁD
# HP-UXłbdfCSolaris 2.xłdf -kCSunOS 4.xłdfD
# Solaris̏ꍇ́C̃IvVi'df -kF ufs'ȂǁjtĂ
# ܂ȂD
DF="/usr/bin/df -k"
AWK="/usr/bin/nawk"

# ..............................................................
# Jn
# ..............................................................
if [ -f "$ERRFILE" ]; then
  #
  # Ot@C̕ۑ
  #
  cat $ERRFILE >> $ERRFILE2
fi
#
# obNAbṽXPW[ǂݍށD
#
$AWK -v dbname=$DBNAME -v this_day=$THIS_DAY '{
    #
    # R[h1擾
    #
    cmd=$0
    sizeofarray=split(cmd,rec," ")
    dbname2=rec[1]
    day_of_week=rec[2]
    backup=rec[3]
    export=rec[4]
    special_task=rec[5]

    if (( dbname2 == dbname ) && ( this_day == day_of_week ))
    print " " backup " " export " " special_task
}' $SCHED_FILE | while read BACKUP EXPORT SPECIAL_TASK
do

  #
  # obNAbvJnOɁCp[^ׂďo
  #
  PARAMETER_MSG="
\n......................................................................
\nBackup Job Parameters:
\n
\nDatabase Name = $DBNAME
\nBackup Type   = $BACKUP
\nExport Type   = $EXPORT
\nSpecial Task  = $SPECIAL_TASK
\n
\nEnvironment Variables:
\nORACLE_HOME   = $ORACLE_HOME
\nORACLE_SID    = $ORACLE_SID
\nPATH          = $PATH
\n......................................................................
\n
"
  echo $PARAMETER_MSG >> $LOGFILE 2> $ERRFILE
  echo $PARAMETER_MSG >> $MSGFILE
  $DF >> $LOGFILE 2> $ERRFILE
  echo " " >> $LOGFILE 2> $ERRFILE

  #
  # obNAbv
  #
  if [ "$BACKUP" != "nobackup" ]; then
    echo "..................................." >> $LOGFILE 2>> $ERRFILE
    echo "Begin backup at `date`" >> $LOGFILE 2>> $ERRFILE
    echo "..................................." >> $LOGFILE 2>> $ERRFILE
    $DBBACKUP_BEGIN $DBNAME $BACKUP $SPECIAL_TASK >> $LOGFILE 2>> $ERRFILE
    echo "$DBBACKUP_BEGIN $DBNAME $BACKUP $SPECIAL_TASK >> $LOGFILE 2>> $ERRFILE"
    echo
    echo
    echo "..................................." >> $LOGFILE 2>> $ERRFILE
    echo "End backup at `date`" >> $LOGFILE 2>> $ERRFILE
    echo "..................................." >> $LOGFILE 2>> $ERRFILE
  fi

  #
  # GNX|[g
  #
  if [ "$EXPORT" != "noexport" ]; then
    echo "..................................." >> $LOGFILE 2>> $ERRFILE
    echo "Begin export at `date`" >> $LOGFILE 2>> $ERRFILE
    echo "..................................." >> $LOGFILE 2>> $ERRFILE
    $DBEXPORT_BEGIN $DBNAME $EXPORT $SPECIAL_TASK >> $LOGFILE 2>> $ERRFILE
    echo "$DBEXPORT_BEGIN $DBNAME $EXPORT $SPECIAL_TASK >> $LOGFILE 2>> $ERRFILE"
    echo
    echo
    echo "..................................." >> $LOGFILE 2>> $ERRFILE
    echo "End export at `date`" >> $LOGFILE 2>> $ERRFILE
    echo "..................................." >> $LOGFILE 2>> $ERRFILE
  fi

  echo " " >> $MSGFILE
  echo "Backup log file errors and warnings:" >> $MSGFILE

  echo " " >> $LOGFILE 2>> $ERRFILE
  $DF >> $LOGFILE 2>> $ERRFILE
  echo " " >> $LOGFILE 2>> $ERRFILE

  #
  # G[
  #
  egrep -e error -e warning -e ORA- -e EXP- -e fatal $LOGFILE | grep -v "No errors." >> $MSGFILE
  ERRCNT=`egrep -e error -e ORA- -e EXP- -e fatal $LOGFILE | grep -c -v "No errors."`
  egrep -e error -e warning -e ORA- -e EXP- -e fatal $ERRFILE | grep -v "Export terminated successfully" >> $MSGFILE
  ERRCNT2=`egrep -e error -e ORA- -e EXP- -e fatal $ERRFILE | grep -c -v "Export terminated successfully"`
  END_JOB="`date`"
  if [ "$ERRCNT" -gt 0 -o "$ERRCNT2" -gt 0 ]
  then MSG="$DBNAME backup failed at ${END_JOB}"
  else MSG="$DBNAME backup succeeded at ${END_JOB}"
  fi

  echo " " >> $MSGFILE
  echo "Log files: " >> $MSGFILE
  echo "Log file=$LOGFILE" >> $MSGFILE
  echo "Error file=$ERRFILE" >> $MSGFILE
  echo "Message file=$MSGFILE" >> $MSGFILE

  # f[^x[Ẍ惌|[g̍쐬
  # XNvgspace_reportɂ́Cf[^x[XŎgp\ȗ̈Ɋւ
  # 擾邽߂SQLLqDɎD
  #
  #   svrmgrl <<EOF
  #   connect internal
  #   spool <file_name>
  #   select tablespace_name, sum(bytes) from dba_free_space
  #    group by tablespace_name;
  #   exit
  # EOF
  #
  # ̃XNvg̃ZbgAbvIC̍s̃Rg邱ƁD

  # $TOOLS/sql/space_report $DBNAME

  #
  # DBASɃ[𑗕t
  # obNAbvWȕIDBASɃ[𑗐Mꍇ́C
  # L̍s̃RgDł́C[OXg܂͕ʖ
  # "${DBNAME}_dbasVXeɑ݂Ă̂Ɖ肵ĂDłȂ
  # ꍇ́CM҂̖OKXC邱ƁD܂C̃[R}h́C
  # vbgtH[ɍ킹ĕύXKvȂD
  #     /usr/bin/mailx -s "$MSG" ${DBNAME}_dbas < $MSGFILE

  #
# ϐADMIN_FILEɒlݒ肵C̍s̃Rg邱ƁD
#  . $ADMIN_FILE
done


p.189-200
#! /bin/sh
# O        $TOOLS/backup/dbbackup_begin
# ړI        f[^x[X̃obNAbvsD
# N@     $TOOLS/backup/dbbackup_begin <dbname> <backup>
#            <special task>

# p[^	$1=f[^x[X
# 			$2=obNAbṽ^Cv
# 			$3=^XN
#
#
# ..............................................................
# [Jϐ̐ݒ
# ..............................................................
ERRMSG="
`basename $0`: syntax error:
    dbbackup_begin <dbname> <hot|cold|nobackup> <special task>.
"
#
# p[^
#
if [ "$1" ]
then DBNAME=$1
else echo $ERRMSG  >&2
     exit 1
fi
if [ "$2" ]
then BACKUP=$2
else echo $ERRMSG  >&2
     exit 1
fi
if [ "$3" ]
then SPECIAL_TASK=$3
else SPECIAL_TASK=" "
fi

#
# u[l
#
TRUE=0
FALSE=1
SHUTDOWN_FAILED_B=1
RESTART_FAILED_B=1

#
# [Jϐ
#
JOBNAME="$TOOLS/backup/dbbackup_begin"
JOBNAME_SHORT="dbbackup_begin"
LOGDIR="$TOOLS/db_admin/db_$DBNAME/log/"
DBBACKUP="$LOGDIR/datafile_`date '+%y%m%d'.log"
CTLFILES="$LOGDIR/control_`date '+%y%m%d'.log"
ARCHLOGS="$LOGDIR/archlog_`date '+%y%m%d'.log"
ALERTLOG="$LOGDIR/alertlog_`date '+%y%m%d'.log"
SPECIALOG="$LOGDIR/special_`date '+%y%m%d'.log"

# ̃R}h̊i[ꏊ́CVXeɂĈقȂĂD
WALL="/usr/sbin/wall"
CKSUM="/bin/cksum"
CMP="/bin/cmp"

BANNER="$TOOLS/db_admin/db_${DBNAME}/banner/status"
CKSUM_SIZE_ERR="${JOBNAME_SHORT}: fatal error in cksum size comparison."
CKSUM_VALUE_ERR="${JOBNAME_SHORT}: fatal error in cksum value comparison."
CKSUM_VALUE_WAR="${JOBNAME_SHORT}: warning in cksum value comparison."
CMP_ERR="${JOBNAME_SHORT}: fatal error in cmp."
ARCERR="${JOBNAME_SHORT}: fatal error in archive log copy."
THISNODE=`uname -n`

# ..............................................................
# Jn
# ..............................................................

#
# f[^x[XICԂɂ邩ǂ̃`FbND
# 'grep -w'gCf[^x[X҂v邩ǂ`FbND
# *** HP-UX 9.xł́Cgrep'-w'XCb`Ȃ ***
# L̃R}h́C'grep "ora_[a-z]*_${DBNAME}\$"'ƕύXKv
# ȂD
#
STATUS=`ps -fu oracle | grep -w "ora_[a-z]*_${DBNAME}" `
if [ $? != 0 ]; then
  # obNOEhvZX1삵ĂȂiDB~Ăjꍇ
  if [ "$BACKUP" = "hot" ]; then
    # zbgobNAbv́CӖȂȂD
    echo "${JOBNAME_SHORT}: Database is not online. Switching to cold backup"
    echo "${JOBNAME_SHORT}: Database is not online. Switching to cold backup">&2
    BACKUP="cold"
  else
    # R[hobNAbv̏ꍇ́C̍sł悢D
    echo "${JOBNAME_SHORT}: Database is already down.  Continuing."
  fi
else
  # since database is already up
  if [ "$BACKUP" = "cold" ]; then

    #
    # f[^x[X~bZ[Wu[hLXgɂĒʒmD
    #
    # $WALL $TOOLS/db_admin/db_${DBNAME}/banner/shutdown_15min.banner
    # sleep 300
    # $WALL $TOOLS/db_admin/db_${DBNAME}/banner/shutdown_5min.banner
    # sleep 240
    # $WALL $TOOLS/db_admin/db_${DBNAME}/banner/shutdown_1min.banner
    # sleep 60
    #
    # gpĂREDOOt@CA[JCuOt@Cł邱Ƃ
    # ~ɂĊmFOɁCK؂Ȓ~XNvggC
    # ~sD
    #
    echo "${JOBNAME_SHORT}: Shutting down immediate."

     svrmgrl >/dev/null <<EOF
     connect internal
     alter system switch logfile;
     shutdown immediate;
     exit
EOF
    # 'grep -w'gCf[^x[X҂v邩ǂ`FbND
    # *** HP-UX 9.xł́Cgrep'-w'XCb`Ȃ ***
    # L̃R}h́C'grep "ora_[a-z]*_${DBNAME}\$"'ƕύXKv
    # ȂD
    #
    STATUS=`ps -fu oracle | grep -w "ora_[a-z]*_${DBNAME}" `
    if [ $? = 0 ]; then
    echo "${JOBNAME_SHORT}: Error in database shutdown. Exiting."
    exit
    fi
    #
    # sqlnetvZX̒f
    #
    echo "${JOBNAME_SHORT}: killing sqlnet v2 processes."
    #
    # 'grep -w'gCf[^x[X҂v邩ǂ`FbND
    # *** HP-UX 9.xł́Cgrep'-w'XCb`Ȃ ***
    # L̃R}h́C'grep "oracle${DBNAME} ("'ƕύXKv
    # ȂD
    #
    PROCS=`ps -ef |grep -w oracle${DBNAME} |grep -v grep |awk '{print $2}'`
    if [ x$PROCS = x ]; then
    echo "${JOBNAME_SHORT}: no processes to kill"
    else
    echo "${JOBNAME_SHORT}: killing processes $PROCS"
    kill $PROCS
    fi
    echo " "
  fi
fi

if [ "$BACKUP" = "cold" ]; then
   echo "${JOBNAME_SHORT}: Starting up restrict."
   svrmgrl >/dev/null <<EOF
   connect internal
   startup mount restrict
   exit
EOF
    # 'grep -w'gCf[^x[X҂v邩ǂ`FbND
    # *** HP-UX 9.xł́Cgrep'-w'XCb`Ȃ ***
    # L̃R}h́C'grep "ora_[a-z]*_${DBNAME}\$"'ƕύXKv
    # ȂD
    #
    STATUS=`ps -fu oracle | grep -w "ora_[a-z]*_${DBNAME}" `
    if [ $? != 0 ]; then
    echo "${JOBNAME_SHORT}: Error in database startup. Exiting."
    exit
    fi

fi

# ......................................................................
# obNAbv̊Jn
# ......................................................................
#
# f[^x[Xt@C̃Xg̍쐬
#

echo "${JOBNAME_SHORT}: building dynamic parameter file."

if [ $BACKUP = "hot" ]; then
  svrmgrl >/dev/null <<EOF
  connect internal
  set termout off
  spool $DBBACKUP;
  select file_name,tablespace_name from sys.dba_data_files
  order by tablespace_name,file_name;
  spool off;
  exit;
EOF

else
  svrmgrl >/dev/null <<EOF
  connect internal
  set termout off
  spool $DBBACKUP;
  select name from v\$datafile;
  spool off;
  exit;
EOF

fi

svrmgrl >/dev/null <<EOF
connect internal
set termout off
spool $CTLFILES;
select name from v\$controlfile;
spool off;
spool $ARCHLOGS;
select value from v\$parameter where name='log_archive_dest';
spool off;
spool $ALERTLOG;
select value from v\$parameter where name='background_dump_dest';
spool off;
exit
EOF

# Ip[^t@C̃TCY`FbN
if [ -z $DBBACKUP ]; then
   echo "${JOBNAME_SHORT}: fatal error during backup file creation.  Backup aborting."
   return
fi

#
# ~
#
if [ $BACKUP = "cold" ]; then
  echo "${JOBNAME_SHORT}: Shutting down immediate."
svrmgrl >/dev/null <<EOF
connect internal
shutdown immediate
exit
EOF

# 'grep -w'gCf[^x[X҂v邩ǂ`FbND
# *** HP-UX 9.xł́Cgrep'-w'XCb`Ȃ ***
# L̃R}h́C'grep "ora_[a-z]*_${DBNAME}\$"'ƕύXKv
# ȂD
#
  STATUS=`ps -fu oracle | grep -w "ora_[a-z]*_${DBNAME}" `
  if [ $? = 0 ]; then
    echo "${JOBNAME_SHORT}: error in shutdown. Cold backup aborting."
    SHUTDOWN_FAILED_B="$TRUE"
  else
    echo "${JOBNAME_SHORT}: Database is shutdown."
    echo "${JOBNAME_SHORT}: move alert log."
    ALERT=`sed -e 's/[    ]*$//' -e '/selected\.$/d' \
     -e '/^---.*--$/d'  -e '/^VALUE/d' $ALERTLOG`
    mv ${ALERT}/alert_${DBNAME}.log \
    ${ALERT}/alert_${DBNAME}.log_`date '+%y%m%d'`
  fi

fi

#
# obNAbv̊Jn
#
if [ $SHUTDOWN_FAILED_B = $FALSE ]; then
  echo " "
  echo "${JOBNAME_SHORT}:  Starting $BACKUP backup using $DBBACKUP..."
  #
  # BACKUPDIRBACKUPDIROLDɈړ
    # ʂ̃obNAbvWuJnOɁCobNAbṽt@C
    # ʂ̏ꏊɈړD
    # Yt@C̃obNAbve[vɍ̎ijꍇ́C
    # ̃t@CCړɍ폜Ă܂ȂD
  #
  if [ `ls ${BACKUPDIR} | wc -l` != 0 ]; then
    for FILE in ${BACKUPDIR}/*
    do
    mv $FILE $BACKUPDIROLD
    done
  fi
  #
  # A[gÕobNAbvRs[쐬D
  #
  if [ $BACKUP = "cold" ]; then
   cp ${ALERT}/alert_${DBNAME}.log_`date '+%y%m%d'` \
   ${BACKUPDIR}
  fi
  #
  # zbgobNAbṽXe[^X`FbND
  #
  if  [ $BACKUP = "hot" ]; then
    svrmgrl <<EOF
    connect internal
    select * from v\$backup;
    exit
EOF
  fi
  #
  # Ip[^t@C̓ǂݍ݂JnD
  #
  if [ $BACKUP = "hot" ]; then
    SED="sed -e '/selected\.$/d' -e '/^---.*--$/d'  -e '/^FILE_NAME/d' \
    $DBBACKUP"
  else
    SED="sed -e '/selected\.$/d' -e '/^---.*--$/d'  -e '/^NAME/d' $DBBACKUP"
  fi

  eval $SED | while read FILE TABLESPACE
  do
    if [ $BACKUP = "hot" ]; then
      svrmgrl <<EOF
      connect internal
      alter tablespace $TABLESPACE begin backup;
      exit
EOF
    fi
    #
    # f[^x[Xt@C̃Rs[
    #

    echo "${JOBNAME_SHORT}: cp $FILE $BACKUPDIR"
    DATAFILE=`basename $FILE`

    # ʂ̃fBNgɓÕf[^x[Xt@C݂Ă
    # \D̂悤ȃt@Cɂ́CԈď㏑Ȃ悤
    # ӂKvD̂߂ɂ́Ĉ悤ȏsD
    #   if [ -f ${BACKUPDIR}/${DATAFILE} ]; then
    #      NEWNAME=`dirname $FILE | tr / _`
    #      cp $FILE ${BACKUPDIR}/${DATAFILE}${NEWNAME}
    #   fi

    cp $FILE $BACKUPDIR
    STATUS=$?
    if [ "$STATUS" != 0 ]; then
      echo  "${JOBNAME_SHORT}: error during file copy $FILE."
    fi
    if [ $BACKUP = "hot" ]; then
      echo "${JOBNAME_SHORT}: $CKSUM $FILE $BACKUPDIR/$DATAFILE"
      $CKSUM $FILE $BACKUPDIR/$DATAFILE
      CKSUM_OUT=`$CKSUM $FILE $BACKUPDIR/$DATAFILE`
      echo $CKSUM_OUT | read VALUE1 SIZE1 NAME1 VALUE2 SIZE2 NAME2
      if [ "$VALUE1" != "$VALUE2" ]; then
        echo "$CKSUM_VALUE_WAR"
      fi
      if [ "$SIZE1" != "$SIZE2" ]; then
        echo "$CKSUM_SIZE_ERR"
      fi
    else
      echo "${JOBNAME_SHORT}: $CMP $FILE $BACKUPDIR/$DATAFILE"
      $CMP $FILE $BACKUPDIR/$DATAFILE
      STATUS="$?"
      if [ "$STATUS" != 0 ]; then
         echo "$CMP_ERR"
      fi
    fi
    if [ $BACKUP = "hot" ]; then
      svrmgrl <<EOF
      connect internal
      alter tablespace $TABLESPACE end backup;
      exit
EOF
    fi
  done
  #
  # zbgobNAbṽXe[^X`FbN
  #
  if  [ $BACKUP = "hot" ]; then
    svrmgrl <<EOF
    connect internal
    select * from v\$backup;
    exit
EOF
  fi
  #
  # t@C̃obNAbv̎悷D
  #
    #
    # t@C
    #
 if [ $BACKUP = "hot" ]; then
    echo "${JOBNAME_SHORT}: backing up controlfile to \
        ${BACKUPDIR}/${DBNAME}_control01.ctl"
    svrmgrl <<EOF
    connect internal
    alter database backup controlfile to '${BACKUPDIR}/control01.ctl';
    exit
EOF
    #
  else
   sed -e '/rows selected\.$/d' -e '/^---.*--$/d'  -e '/^NAME/d' $CTLFILES \
    | while read FILE
   do
    #
    # t@CRs[D
    #
    echo "${JOBNAME_SHORT}: cp $FILE $BACKUPDIR"
    DATAFILE=`basename $FILE`

    # ʂ̃fBNgɓO̐t@C݂Ă
    # \D̂悤ȃt@Cɂ́CԈď㏑Ȃ悤
    # ӂKvD̂߂ɂ́Ĉ悤ȏsD
    #   if [ -f ${BACKUPDIR}/${DATAFILE} ]; then
    #      NEWNAME=`dirname $FILE | tr / _`
    #      cp $FILE ${BACKUPDIR}/${DATAFILE}${NEWNAME}
    #   fi

    cp $FILE $BACKUPDIR
    STATUS=$?
    if [ "$STATUS" != 0 ]; then
      echo  "${JOBNAME_SHORT}: error during file copy $FILE."
    fi
    echo "${JOBNAME_SHORT}: $CMP $FILE $BACKUPDIR/$DATAFILE"
    $CMP $FILE $BACKUPDIR/$DATAFILE
    STATUS="$?"
    if [ "$STATUS" != 0 ]; then
       echo "$CMP_ERR"
    fi
   done
 fi

  #
  # A[JCuO
  #
  # A[JCuÕobNAbv̎悷邱ƁDICREDOOt@C
  # ̃obNAbv̎悵Ă͂ȂD
  #
  # OIɐ؂ւD
  #
  if [ $BACKUP = "hot" ]; then
    svrmgrl <<EOF
    connect internal
    alter system switch logfile;
    exit
EOF
  # Ot@C̃Rs[܂ŁC΂炭X[vD
   sleep 120
  fi
  # A[JCuOt@CRs[D
  #
   ARC=`sed -e 's/[    ]*$//' -e '/selected\.$/d' \
    -e '/^---.*--$/d'  -e '/^VALUE/d' $ARCHLOGS`
  if [ -f $ARCOLD/* ]; then
   echo " "
   echo "${JOBNAME_SHORT}: Delete previous backup archive logs..."
   for I in $ARCOLD/*
     do
      ls -l $I
       ARCNAME=`basename $I`
       rm $ARCOLD/$ARCNAME
       STATUS="$?"
       if [ "$STATUS" != 0 ]; then
        echo "${JOBNAME_SHORT}: error deleting old archive log: $ARCOLD/
             $ARCNAME"
       fi
    done
  else    echo " "
          echo "${JOBNAME_SHORT}: No old archive logs to delete."
  fi

  if [ -f $ARC/* ]; then
    echo " "
    echo "${JOBNAME_SHORT}: Copying archive logs..."
    for I in $ARC/*
      do
         ls -l $I
           ARCNAME=`basename $I`
    echo "${JOBNAME_SHORT}: cp $ARC/$ARCNAME $ARCOLD"
         cp $ARC/$ARCNAME $ARCOLD
    STATUS="$?"
          if [ "$STATUS" != 0 ]; then
            echo "$ARCERR"
    fi
    echo "${JOBNAME_SHORT}: $CMP $ARC/$ARCNAME $ARCOLD/$ARCNAME"
    $CMP $ARC/$ARCNAME $ARCOLD/$ARCNAME
        STATUS="$?"
        if [ "$STATUS" != 0 ]; then
            echo "$CMP_ERR"
            echo "${JOBNAME_SHORT}: Archive log deletion skipped."
           else echo "${JOBNAME_SHORT}: $CKSUM $ARC/$ARCNAME $ARCOLD/
                     $ARCNAME"
        $CKSUM $ARC/$ARCNAME $ARCOLD/$ARCNAME
          CKSUM_OUT=`$CKSUM $ARC/$ARCNAME $ARCOLD/$ARCNAME`
          echo $CKSUM_OUT | read VALUE1 SIZE1 NAME1 VALUE2 SIZE2 NAME2
          if [ "$VALUE1" != "$VALUE2" -o "$SIZE1" != "$SIZE2" ]; then
            echo "$DIFFERR"
            echo "${JOBNAME_SHORT}: Archive log deletion skipped."
          else rm $ARC/$ARCNAME
            if [ $? != 0 ]; then
              echo "${JOBNAME_SHORT}: Archive deletion failed."
            fi
          fi
        fi
      done
  else echo "${JOBNAME_SHORT}: Found no archives to copy."
  fi


 if [ $BACKUP = "cold" ]; then
  # N
  #
    #
    # RESTRICT[h̃^XN
    # 
    if [ "$SPECIAL_TASK" != " " ]; then
        echo "${JOBNAME_SHORT}: Running DBA mode task..."

      svrmgrl >/dev/null <<EOF
      connect intrenal
      startup restrict
      exit
EOF
      STATUS=`ps -fu oracle | grep -w "ora_[a-z]*_${DBNAME}" `
      if [ $? != 0 ]; then
        echo "${JOBNAME_SHORT}: error in database startup."  >&2
        echo "Skipping ${SPECIAL_TASK}."  >&2
      else
          . ${SPECIAL_TASK} > $SPECIALOG 2>&1

      svrmgrl >/dev/null <<EOF
      connect internal
      shutdown
      exit
EOF
     fi
   fi
    #
    # N
    #
   svrmgrl >/dev/null <<EOF
   connect internal
   startup mount;
   alter database archivelog;
   alter database open;
   exit
EOF
    STATUS=`ps -fu oracle | grep -w "ora_[a-z]*_${DBNAME}" `
    if [ $? != 0 ]; then
      echo "${JOBNAME_SHORT}: error in database startup."
      echo "${JOBNAME_SHORT}: error in database startup."  >&2
      RESTART_FAILED_B=0
    else
      echo "${JOBNAME_SHORT}: Database restarted."
      # $WALL $TOOLS/db_admin/db_${DBNAME}/banner/db_online.banner
    fi
 fi

fi


p.200-203
#! /bin/sh
# O        $TOOLS/backup/dbexport_begin
# ړI        f[^x[X̃obNAbvsD
# N@     $TOOLS/backup/dbexport_begin <dbname>
#            <export> <special task>
# p[^ $1=f[^x[X
#            $2=GNX|[g
#            $3=^XN
#
#
# ..............................................................
# [Jϐ
# ..............................................................
ERRMSG='
$0: syntax error:
    dbexport_begin <dbname> <export|noexport> <special task>.
'
#
# p[^
#
if [ "$1" ]
then DBNAME=$1
export DBNAME
else echo $ERRMSG  >&2
     exit 1
fi
if [ "$2" ]
then EXPORT=$2
else echo $ERRMSG  >&2
     exit 1
fi
if [ "$3" ]
then SPECIAL_TASK=$3
else SPECIAL_TASK=" "
fi

#
# u[l
#
TRUE=0
FALSE=1
SHUTDOWN_FAILED_B=1
RESTART_FAILED_B=1

#
# [Jϐ
#
JOBNAME="$TOOLS/backup/dbexport_begin"
JOBNAME_SHORT="dbexport_begin"


CMP="/bin/cmp"
PARFILE="$TOOLS/db_admin/db_$DBNAME/export.par"
CMP_ERR="${JOBNAME_SHORT}: fatal error in cmp."
EXPERR="${JOBNAME_SHORT}: fatal error in export file copy."

# ..............................................................
# Jn
# ..............................................................


#
# f[^x[XICԂɂ邩ǂ̃`FbND
# 'grep -w'gCf[^x[X҂v邩ǂ`FbND
# *** HP-UX 9.xł́Cgrep'-w'XCb`Ȃ ***
# L̃R}h́C'grep "ora_[a-z]*_${DBNAME}\$"'ƕύXKv
# ȂD
#
STATUS=`ps -fu oracle | grep -w "ora_[a-z]*_${DBNAME}" `
if [ $? != 0 ]; then
  echo "${JOBNAME_SHORT}: error - database not online."
  echo "${JOBNAME_SHORT}: error - database not online."  >&2
  echo "${JOBNAME_SHORT}: process listing is to follow..."  >&2
  echo "${JOBNAME_SHORT}: ps -fu oracle | grep -w \"ora_[a-z]*_$DBNAME\""  >&2
  ps -fu oracle | grep -w "ora_[a-z]*_${DBNAME}"  >&2
  echo "${JOBNAME_SHORT}: exiting."  >&2
  exit 1
fi

# ......................................................................
# GNX|[g
# ......................................................................
echo " "
echo "${JOBNAME_SHORT}: List previous export files..."
ls -l $EXPORTDIR/${DBNAME}.exp*
ls -l $EXPORTDIROLD/${DBNAME}.exp*

#
# GNX|[g̍폜
#
if [ -f $EXPORTDIROLD/${DBNAME}.exp_old ]; then
  rm $EXPORTDIROLD/${DBNAME}.exp_old
  if [ $? != 0 ]; then
    echo "${JOBNAME_SHORT}: error deleting previous export."
  else
    echo "${JOBNAME_SHORT}: Deleted previous export file."
  fi
else echo "${JOBNAME_SHORT}: Found no previous export file."
fi    
#
# ݂̃GNX|[gGNX|[gɃRs[D
#
if [ -f $EXPORTDIR/${DBNAME}.exp ]; then
  chmod 644 $EXPORTDIR/${DBNAME}.exp
  echo "${JOBNAME_SHORT}: cp $EXPORTDIR/${DBNAME}.exp $EXPORTDIROLD"
  cp $EXPORTDIR/${DBNAME}.exp $EXPORTDIROLD
  if [ $? != 0 ]; then
    echo "$EXPERR"
  else echo "${JOBNAME_SHORT}: $CMP $EXPORTDIR/${DBNAME}.exp $EXPORTDIROLD/${DBNAME}.exp"
    $CMP $EXPORTDIR/${DBNAME}.exp $EXPORTDIROLD/${DBNAME}.exp
    STATUS="$?"
    if [ "$STATUS" != 0 ]; then
      echo "$CMP_ERR"
    fi
    echo "${JOBNAME_SHORT}: mv ${EXPORTDIROLD}/${DBNAME}.exp ${EXPORTDIROLD}/${DBNAME}.exp_old"
    mv ${EXPORTDIROLD}/${DBNAME}.exp ${EXPORTDIROLD}/${DBNAME}.exp_old
    if [ $? != 0 ]; then
      echo "$EXPERR"
    fi
    rm $EXPORTDIR/${DBNAME}.exp
    if [ $? != 0 ]; then
      echo "${JOBNAME_SHORT}: error deleting export file."
      exit
    fi
  fi
else echo "${JOBNAME_SHORT}: Found no current export file to copy."
fi

#
# GNX|[g̊Jn
#
exp parfile=$PARFILE
echo " "
echo "${JOBNAME_SHORT}: Export complete.  "
ls -l $EXPORTDIR/${DBNAME}.exp*
ls -l $EXPORTDIROLD/${DBNAME}.exp*


p.203
V7PROD Sat cold export /bugdev/db_management/bug_restrict1.sh


bkup_tst Sun hot export
bkup_tst Mon hot export
bkup_tst Tue hot export
bkup_tst Wed hot export
bkup_tst Thu hot export
bkup_tst Fri cold export
bkup_tst Sat nobackup export
V7PROD Sun hot noexport
V7PROD Mon hot noexport
V7PROD Tue hot noexport
V7PROD Wed hot noexport
V7PROD Thu hot noexport
V7PROD Fri cold export /bugdev/db_management/bug_restrict1.sh
V7PROD Sat cold export /bugdev/db_management/bug_restrict1.sh     


p.204
#!/bin/sh
#
# PȂTvt@CDJX^}CY\D
#
# O:          @crontab.env
#
# ړI@@@@@@@@obNAbv܂̓GNX|[g̑ΏۂƂȂf[^x[X
#@@@@@@@@@@@ϐݒ肷DfBNgD

if [ $# -lt 1 ]
then
echo "Database name required"
exit 1
fi

# f[^x[XƂɐݒ肷ϐ:
# ORACLE_HOME, ORACLE_SID, PATH
# EXPORTDIROLDiGNX|[gt@C̈ړfBNgj
# EXPORTDIRiGNX|[gt@C̊i[fBNgj
# BACKUPDIRiobNAbvt@C̊i[fBNgj
# BACKUPDIROLDiobNAbvt@C̈ړfBNg|
#          obNAbve[vɈړς݂̏ꍇ͕svj
# ARCOLDiA[JCuOt@C̊i[fBNgj

case $1 in
    bkup_tst) ORACLE_HOME=/home3/oradata/app/oracle/product/7.3.2;
          ORACLE_SID=bkup_tst;
          PATH=/usr/bin:/usr/sbin:$ORACLE_HOME/bin ;
          EXPORTDIROLD=/home3/oracle/bkup/db_${1}/old_export.dir;
          EXPORTDIR=/home3/oracle/bkup/db_${1}/export.dir;
          BACKUPDIR=/home3/oracle/bkup/db_${1}/backup.dir;
          BACKUPDIROLD=/home3/oracle/bkup/db_${1}/old_backup.dir;
          ARCOLD=/home3/oracle/bkup/db_${1}/archive.dir;
            ;;
        
    *)      echo "No such database";
          exit 1 ;;
esac

export ORACLE_HOME ORACLE_SID PATH EXPORTDIR EXPORTDIROLD
export BACKUPDIR BACKUPDIROLD ARCOLD


p.205-207
File name: sample_run.log
Description: A log file generated during a sample run of the scripts.

......................................................................
Backup Job Parameters:
Database Name = bkup_tst
Backup Type = cold
Export Type = noexport
Special Task =

Environment Variables:
ORACLE_HOME = /home3/oradata/app/oracle/product/7.3.2
ORACLE_SID = bkup_tst
PATH = /usr/bin:/usr/sbin:/home3/oradata/app/oracle/product/7.3.2/bin
......................................................................

Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0      67815   41908   19127    69%    /
/dev/dsk/c0t0d0s6     336863  202467  100716    67%    /usr
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c0t0d0s5      28959    9343   16726    36%    /var
/dev/dsk/c0t0d0s7    1389366  367679  882757    30%    /home1
swap                  170976     656  170320     1%    /tmp
/dev/md/dsk/d0       3895250  458964 3046766    14%    /home2
/dev/md/dsk/d1       1947253 1335645  416888    77%    /home3
/dev/dsk/c1t11d0s6   1952573 1100733  656590    63%    /home4

...................................
Begin backup at Sat May 17 14:22:17 IST 1997
...................................
dbbackup_begin: Database is already down.  Continuing.
dbbackup_begin: Starting up restrict.
dbbackup_begin: building dynamic parameter file.
dbbackup_begin: Shutting down immediate.
dbbackup_begin: Database is shutdown.
dbbackup_begin: move alert log.

dbbackup_begin:  Starting cold backup using
/home3/oracle/bkup/db_admin/db_bkup_tst/log//datafile_970517.log...
dbbackup_begin: cp /home3/oradata/bkup_tst/system01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/system01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir/system01.dbf
dbbackup_begin: cp /home3/oradata/bkup_tst/rbs01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/rbs01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir/rbs01.dbf
dbbackup_begin: cp /home3/oradata/bkup_tst/temp01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/temp01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir/temp01.dbf
dbbackup_begin: cp /home3/oradata/bkup_tst/tools01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/tools01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir/tools01.dbf
dbbackup_begin: cp /home3/oradata/bkup_tst/users01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/users01.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir/users01.dbf
dbbackup_begin: cp /home3/oradata/bkup_tst/tools02.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/tools02.dbf
/home3/oracle/bkup/db_bkup_tst/backup.dir/tools02.dbf
dbbackup_begin: cp /home3/oradata/bkup_tst/control01.ctl
/home3/oracle/bkup/db_bkup_tst/backup.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/control01.ctl
/home3/oracle/bkup/db_bkup_tst/backup.dir/control01.ctl
dbbackup_begin: cp /home3/oradata/bkup_tst/control02.ctl
/home3/oracle/bkup/db_bkup_tst/backup.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/control02.ctl
/home3/oracle/bkup/db_bkup_tst/backup.dir/control02.ctl
dbbackup_begin: cp /home3/oradata/bkup_tst/control03.ctl
/home3/oracle/bkup/db_bkup_tst/backup.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/control03.ctl
/home3/oracle/bkup/db_bkup_tst/backup.dir/control03.ctl

dbbackup_begin: Delete previous backup archive logs...
-rw-r-----   1 oracle   dba        50688 May 17 14:07
/home3/oracle/bkup/db_bkup_tst/archive.dir/1_88.dbf

dbbackup_begin: Copying archive logs...
-rw-r-----   1 oracle   dba         5120 May 17 14:12
/home3/oradata/bkup_tst/archlog/1_89.dbf
dbbackup_begin: cp /home3/oradata/bkup_tst/archlog/1_89.dbf
/home3/oracle/bkup/db_bkup_tst/archive.dir
dbbackup_begin: /bin/cmp /home3/oradata/bkup_tst/archlog/1_89.dbf
/home3/oracle/bkup/db_bkup_tst/archive.dir/1_89.dbf
dbbackup_begin: /bin/cksum /home3/oradata/bkup_tst/archlog/1_89.dbf
/home3/oracle/bkup/db_bkup_tst/archive.dir/1_89.dbf
3991599986    5120    /home3/oradata/bkup_tst/archlog/1_89.dbf
3991599986    5120    /home3/oracle/bkup/db_bkup_tst/archive.dir/1_89.dbf
dbbackup_begin: Database restarted.
...................................
End backup at Sat May 17 14:22:49 IST 1997
...................................

Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0      67815   41908   19127    69%    /
/dev/dsk/c0t0d0s6     336863  202467  100716    67%    /usr
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c0t0d0s5      28959    9343   16726    36%    /var
/dev/dsk/c0t0d0s7    1389366  367679  882757    30%    /home1
swap                  163064     664  162400     1%    /tmp
/dev/md/dsk/d0       3895250  458964 3046766    14%    /home2
/dev/md/dsk/d1       1947253 1337664  414869    77%    /home3
/dev/dsk/c1t11d0s6   1952573 1100733  656590    63%    /home4



Chapter5
p.211
SQL> update emp set empno=1234 where empno = 9999;


p.212-213
SVRMGR> archive log list
Database log mode               Archive Mode
Automatic archival                Enabled
Archive destination             D:\ORANT\DATABASE\ARCHIVE
Oldest online log sequence      1742
Next log sequence to archive    1744
Current log sequence            1744


p.215
SQL> select * from v$log_history where rownum < 3;
  RECID    STAMP   THREAD# SEQUENCE# FIRST_CHANGE# FIRST_TIM NEXT_CHANGE#
------- --------- -------- --------- ------------- --------- ------------
      1 316115149        1         1             1 01-NOV-97          108
      2 316115154        1         2           108 01-NOV-97          130


p.217
SQL> alter database add logfile thread 2 group 3 
'c:\orant\database\log3.ora' size 200k;
Database altered.
SQL> alter database add logfile thread 2 group 4 
'c:\orant\database\log4.ora' size 200k;
Database altered.
SQL> alter database enable public thread 2;
Database altered.
SQL> alter database disable thread 2;
Database altered.


p.219
SVRMGR> alter database enable thread 2;
Statement processed.
SVRMGR> alter database disable thread 2;
Statement processed.


p.223
SVRMGR> alter system checkpoint local;
Statement processed.


p.246
RECOVER DATABASE

RECOVER TABLESPACE

RECOVER DATAFILE


p.248
RECOVER [AUTOMATIC] [FROM 'location'] [DATABASE]
| [UNTIL CANCEL]
| [UNTIL TIME date]
| [UNTIL CHANGE integer]
[USING BACKUP CONTROLFILE]


p.249
SVRMGR> RECOVER DATABASE


p.251
SVRMGR> recover database until cancel;

SVRMGR> recover database until time '1995-04-15:17:55:00';

SVRMGR> recover database until change integer;

SVRMGR> recover database until cancel using backup controlfile;


p.256
SVRMGR> archive log list
Database log mode                Archive Mode
Automatic archival               Enabled
Archive destination              /home/orahome/product/7.3.3/dbs/arch
Oldest online log sequence       61
Next log sequence to archive   63
Current log sequence           63

SVRMGR> recover database until cancel;
Media recovery complete.
SVRMGR> alter database open resetlogs;
Statement processed.
SVRMGR> archive log list;
Database log mode                Archive Mode
Automatic archival               Enabled
Archive destination            /home/orahome/product/7.3.3/dbs/arch
Oldest online log sequence     0
Next log sequence to archive   1
Current log sequence           1


p.260
RECOVER [AUTOMATIC] [FROM location]
| TABLESPACE tablespace_name [, tablespace_name...]


p.262
RECOVER [AUTOMATIC] [FROM location]
| DATAFILE 'filename' ['filename',...]


p.266
CREATE CONTROLFILE [REUSE] [SET]
DATABASE [dbname]
LOGFILE filespec [, filespec, ...]
RESETLOGS | NORESETLOGS
DATAFILE filespec [, filespec, ...]
[MAXLOGIFLES integer]
[MAXLOGMEMBERS integer]
[MAXLOGHISTORY integer]
[MAXDATAFILES integer]
[MAXINSTANCES integer]
[ARCHIVELOG | NOARCHIVELOG]


p.267
SVRMGR> ALTER DATABASE BACKUP CONTROLFILE TO TRACE;


SVRMGR> ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
Statement processed.


p.267-268
Dump file C:\ORANT\RDBMS80\trace\ORA00174.TRC
Sat Nov 01 19:08:35 1997
ORACLE V8.0.3.0.0 - Production vsnsta=0
vsnsql=c vsnxtr=3
Windows NT V4.0, OS V5.101, CPU type 586
Oracle8 Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
Windows NT V4.0, OS V5.101, CPU type 586
Instance name: orcl
Redo thread mounted by this instance: 1
Oracle process number: 11
pid: ae
Sat Nov 01 19:08:35 1997
Sat Nov 01 19:08:35 1997
*** SESSION ID:(10.1) 1997.11.01.19.08.35.284
# The following commands will create a new control file and use it
# to open the database.
# Data used by the recovery manager will be lost. Additional logs may
# be required for media recovery of offline data files. Use this
# only if the current version of all online logs are available.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORACLE" NORESETLOGS NOARCHIVELOG
    MAXLOGFILES 32
    MAXLOGMEMBERS 2
    MAXDATAFILES 32
    MAXINSTANCES 16
    MAXLOGHISTORY 1630
LOGFILE
  GROUP 1 'C:\ORANT\DATABASE\LOG1ORCL.ORA'  SIZE 200K,
  GROUP 2 'C:\ORANT\DATABASE\LOG2ORCL.ORA'  SIZE 200K,
  GROUP 3 'C:\ORANT\DATABASE\LOG3.ORA'  SIZE 200K,
  GROUP 4 'C:\ORANT\DATABASE\LOG4.ORA'  SIZE 200K
DATAFILE
  'C:\ORANT\DATABASE\SYS1ORCL.ORA',
  'C:\ORANT\DATABASE\USR1ORCL.ORA',
  'C:\ORANT\DATABASE\RBS1ORCL.ORA'
;
# Recovery is required if any of the data files are restored backups,
# or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# Database can now be opened normally.
ALTER DATABASE OPEN;


p.268
SVRMGR> ALTER DATABASE CREATE DATAFILE 'filename';


p.275
c:\orant\bin> svrmgr30
Oracle Server Manager Release 3.0.3.0.0 - Production
(c) Copyright 1997, Oracle Corporation.  All Rights Reserved.
Oracle8 Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
SVRMGR> connect system/manager@rcv
Connected.
SVRMGR> create user rman identified by aa
     2> default tablespace user_data
     3> temporary tablespace temporary_data;
Statement processed.
SVRMGR> grant connect, resource to rman;
Statement processed.
SVRMGR> grant recovery_catalog_owner to rman;
Statement processed.


SQL> connect rman/aa@rcv
Connected.
SQL> @c:\orant\rdbms80\admin\catrman.sql
DROP SEQUENCE rman_seq
              *
ERROR at line 1:
ORA-02289: sequence does not exist 
DROP TABLE    rcver
              *
ERROR at line 1:
ORA-00942: table or view does not exist
.
.
.
.
View created.
Package created.
Grant succeeded.
No errors.
Package body created.
No errors.
Package created.
No errors.
Package body created.
No errors.
SQL> exit


p.276
C:\ORANT\BIN>rman80 target=\"internal/oracle@prod\" rcvcat=\"rman/aa\@rcv"
Recovery Manager: Release 8.0.3.0.0 - Production
RMAN-06005: connected to target database: ORACLE
RMAN-06008: connected to recovery catalog database
RMAN> register database;
RMAN-03022: compiling command: register
RMAN-03023: executing command: register
RMAN-08006: database registered in recovery catalog
RMAN-03023: executing command: full resync
RMAN-08002: starting full resync of recovery catalog
RMAN-08004: full resync complete
RMAN> list incarnation of database;
RMAN-03022: compiling command: list
RMAN-06240: List of Database Incarnations
RMAN-06241: DB Key Inc Key DB Name  DB ID      CUR Reset SCN Reset Time
RMAN-06242: ------ ------- -------- ---------- --- --------- -------
RMAN-06243: 1      2       ORACLE   1186495900 YES 16927     01-OCT-97


RMAN> resync catalog;
RMAN-03022: compiling command: resync
RMAN-03023: executing command: resync
RMAN-08002: starting full resync of recovery catalog
RMAN-08004: full resync complete


p.279
RMAN> run {
2> allocate channel c1 type disk;
3> backup full filesperset 3
4>  (database format 'aa_%p%d.%s');
5> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=8 set_stamp=315570188
RMAN-00569: ===============error message stack follows===============
RMAN-03007: retryable error occurred during execution of command: backup
RMAN-07004: unhandled exception during command execution on channel c1
RMAN-10032: unhandled exception during execution of job step 1: ORA-06512: at line 57
RMAN-10035: exception raised in RPC: ORA-19624: operation failed, retry possible
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
ORA-06512: at "SYS.DBMS_BACKUP_RESTORE", line 301
RMAN-10031: ORA-19624 occurred during call to 
DBMS_BACKUP_RESTORE.BACKUPDATAFILE



p.279-280
RMAN> run {
2> allocate channel c1 type disk;
3> backup full filesperset 3
4>  (database format 'aa_%p%d.%s');
5> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=3 set_stamp=315520175
RMAN-08010: channel c1: including datafile 1 in backupset
RMAN-08010: channel c1: including datafile 2 in backupset
RMAN-08010: channel c1: including datafile 3 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AA_FULL1ORACLE.3 comment=NONE
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=4 set_stamp=315520265
RMAN-08010: channel c1: including datafile 4 in backupset
RMAN-08011: channel c1: including current controlfile in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AA_FULL1ORACLE.4 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.280-281
RMAN> run{
2> allocate channel c1 type disk;
3> copy datafile 'c:\orant\database\sys1orcl.ora' to 'd:\temp\sys1orcl.bak';
4> copy datafile 'c:\orant\database\usr1orcl.ora' to 'd:\temp\usr1orcl.bak';
5> copy datafile 'c:\orant\database\rbs1orcl.ora' to 'd:\temp\rbs1orcl.bak';
6> copy current controlfile to 'd:\temp\cntrlora.bak';
7> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=16 devtype=DISK
RMAN-03022: compiling command: copy
RMAN-03025: performing implicit partial resync of recovery catalog
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03023: executing command: copy
RMAN-08000: channel c1: copied datafile 1
RMAN-08501: output filename=D:\TEMP\SYS1ORCL.BAK recid=7 stamp=315640903
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: copy
RMAN-03023: executing command: copy
RMAN-08000: channel c1: copied datafile 2
RMAN-08501: output filename=D:\TEMP\USR1ORCL.BAK recid=8 stamp=315640923
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: copy
RMAN-03023: executing command: copy
RMAN-03022: compiling command: copy
RMAN-03023: executing command: copy
RMAN-08000: channel c1: copied datafile 3
RMAN-08501: output filename=D:\TEMP\RBS1ORCL.BAK recid=9 stamp=315640978
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: copy
RMAN-03023: executing command: copy
RMAN-08027: channel c1: copied current controlfile
RMAN-08505: output filename=D:\TEMP\CNTRLORA.BAK
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.282
SVRMGR> alter tablespace test begin backup;
Statement processed.
SVRMGR> host
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.
C:\ORANT\DATABASE>copy tst1orcl.ora d:\backup\tst1orcl.bak
        1 file(s) copied.
C:\ORANT\DATABASE>exit
SVRMGR> alter tablespace test end backup;
Statement processed.

RMAN> catalog datafilecopy 'd:\backup\tst1orcl.bak';
RMAN-03022: compiling command: catalog
RMAN-03023: executing command: catalog
RMAN-08050: cataloged datafile copy
RMAN-08513: datafile copy filename=D:\BACKUP\TST1ORCL.BAK recid=6 stamp=
315596990
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN> list copy of tablespace "test";
RMAN-03022: compiling command: list
RMAN-06210: List of Datafile Copies
RMAN-06211: Key    File S Completion time Ckp SCN   Ckp time   Name
RMAN-06212: ------ ---- - --------------- --------- ---------- ------
RMAN-06213: 635    5    A 26-OCT-97       685116    26-OCT-97
                                                             D:\BACKUP\
                                                             TST1ORCL.BAK


p.283
RMAN> run {
2> allocate channel c1 type disk;
3> backup tablespace "test"
4> filesperset 3
5> format 'aatst_%t%s.%p';
6> }
RMAN-08031: released channel: c1
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=10 set_stamp=315571221
RMAN-08010: channel c1: including datafile 5 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AATST_31557122110.1 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


C:\ORANT\DATABASE>dir aatst*
 Volume in drive C is MS-DOS_6
 Volume Serial Number is 2338-6CE4
 Directory of C:\ORANT\DATABASE
10/26/97  10:40a                 12,800 AATST_31557122110.1
               1 File(s)         12,800 bytes
                             52,330,496 bytes free


p.283-284
RMAN> list copy of tablespace "test";
RMAN-03022: compiling command: list
RMAN-06210: List of Datafile Copies
RMAN-06211: Key  File S Completion time Ckp SCN  Ckp time  Name
RMAN-06212: ---- ---- - -------------   -------  --------- ------
RMAN-06213: 484  5    D 26-OCT-97       564663   26-OCT-97 C:\ORANT\
                                                           DATABASE\
                                                            TST1ORCL.ORA
  RMAN> list backupset of datafile "c:\orant\database\tst1orcl.ora";
RMAN-03022: compiling command: list
RMAN-06230: List of Datafile Backups
RMAN-06231: Key  File Type     LV Completion_time Ckp SCN   Ckp Time
RMAN-06232: ---- ---- -------- -- --------------- --------- --------
RMAN-06233: 450  5    Full     26-OCT-97          564663    26-OCT-97
RMAN-06233: 569  5    Full     26-OCT-97          664935    26-OCT-97
RMAN> report unrecoverable tablespace 'test';
RMAN-03022: compiling command: report
RMAN-06250: Report of files that need backup due to unrecoverable operations
RMAN-06251: File Type of Backup Required  Name
RMAN-06252: ---- ------------------------ --------------------------


p.284
RMAN> run {
2> allocate channel c1 type disk;
3> copy datafile 'c:\orant\database\tst1orcl.ora' to 'd:\temp\tst1orcl.bak';
4> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=16 devtype=DISK
RMAN-03022: compiling command: copy
RMAN-03023: executing command: copy
RMAN-08000: channel c1: copied datafile 5
RMAN-08501: output filename=D:\TEMP\TST1ORCL.BAK recid=11 stamp=315641931
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.285
RMAN> run {
2> allocate channel c1 type disk;
3> backup datafile 'c:\orant\database\tst1orcl.ora'
4> format 'aatst_%t%s.%p';
5> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=11 set_stamp=315572508
RMAN-08010: channel c1: including datafile 5 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AATST_31557250811.1 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.286
RMAN> run {
2> allocate channel c1 type disk;
3> backup current controlfile
4> format 'aa_ctl%t.%s';
5> }
RMAN-08031: released channel: c1
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=14 set_stamp=315573337
RMAN-08011: channel c1: including current controlfile in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AA_CTL315573337.14 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.286-287
RMAN> run {
2> allocate channel c1 type disk;
3> backup datafile 'c:\orant\database\tst1orcl.ora'
4> include current controlfile
5> format 'aa_tstcf%t.%s';
6> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=15 set_stamp=315573708
RMAN-08010: channel c1: including datafile 5 in backupset
RMAN-08011: channel c1: including current controlfile in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AA_TSTCF315573708.15 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.287
RMAN> run{
2> allocate channel c1 type disk;
3> copy current controlfile to 'd:\temp\cntlora.bak';
4> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=16 devtype=DISK
RMAN-03022: compiling command: copy
RMAN-03023: executing command: copy
RMAN-08027: channel c1: copied current controlfile
RMAN-08505: output filename=D:\TEMP\CNTLORA.BAK
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1 


p.288
RMAN> run {
2> allocate channel c1 type disk;
3> backup archivelog low logseq 391 high logseq 392 thread 1
4> format 'aaarc%t.%s';
5> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08009: channel c1: starting archivelog backupset
RMAN-08502: set_count=16 set_stamp=315595651
RMAN-08014: channel c1: including archivelog in backup set
RMAN-08504: input archivelog thread=1 sequence=391 recid=22 stamp=315576047
RMAN-08014: channel c1: including archivelog in backup set
RMAN-08504: input archivelog thread=1 sequence=392 recid=23 stamp=315593745
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AAARC315595651.16 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.289
RMAN> run{
2> allocate channel c1 type disk;
3> copy archivelog 'c:\orant\database\archive\ORCLT0001S0000000391.ARC' to
4> 'c:\temp\arch391.bak';
5> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=16 devtype=DISK
RMAN-03022: compiling command: copy
RMAN-03023: executing command: copy
RMAN-08026: channel c1: copied archivelog
RMAN-08504: input archivelog thread=1 sequence=391 recid=22 stamp=315576047
RMAN-08501: output filename=C:\TEMP\ARCH391.BAK recid=26 stamp=315643162
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.290
RMAN> run {
2> allocate channel c1 type disk;
3> backup incremental level 0
4> format 'sunday%t.%s'
5> filesperset 5
6> tablespace "test";
7> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=1 set_stamp=316177836
RMAN-08010: channel c1: including datafile 4 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=SUNDAY316177836.1 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.290-291
RMAN> run {
2> allocate channel c1 type disk;
3> backup incremental level 2
4> format 'level2%t.%s'
5> filesperset 5
6> tablespace "test";
7> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=2 set_stamp=316178049
RMAN-08010: channel c1: including datafile 4 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=LEVEL2316178049.2 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.291
RMAN> run {
2> allocate channel c1 type disk;
3> backup incremental level 1
4> format 'level1%t.%s'
5> filesperset 5
6> tablespace "test";
7> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=3 set_stamp=316178473
RMAN-08010: channel c1: including datafile 4 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=LEVEL1316178473.3 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.292
RMAN> run {
2> allocate channel c1 type disk;
3> backup incremental level 2
4> format 'level2%t.%s'
5> filesperset 5
6> tablespace "test";
7> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=4 set_stamp=316178671
RMAN-08010: channel c1: including datafile 4 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=LEVEL2316178671.4 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.292-293
RMAN> list copy of tablespace "test";
RMAN-03022: compiling command: list
RMAN-06210: List of Datafile Copies
RMAN-06211: Key File S Completion time Ckp SCN Ckp time  Name
RMAN-06212: --- ---- - --------------- ------- --------- --------- 
RMAN-06213: 484 5    D 26-OCT-97       564663  26-OCT-97 C:\ORANT\
                                                         DATABASE\
                                                         TST1ORCL.ORA
RMAN-06213: 635 5    A 26-OCT-97       685116  26-OCT-97 D:\BACKUP\
                                                         TST1ORCL.BAK
RMAN> change datafilecopy 635 delete;
RMAN-03022: compiling command: change
RMAN-08070: deleted datafile copy
RMAN-08513: datafile copy filename=D:\BACKUP\TST1ORCL.BAK recid=6 stamp=
315596990
D:\BACKUP>dir t*
 Volume in drive D is MS-DOS_6
 Volume Serial Number is 2338-6CE4
 Directory of D:\BACKUP
10/26/97  05:17p             1,050,624 tmp1orcl.ora
10/26/97  05:17p                53,248 TST1ORCL.ORA


p.293
RMAN> report unrecoverable tablespace "test";
RMAN-03022: compiling command: report
RMAN-06250: Report of files that need backup due to unrecoverable operations
RMAN-06251: File Type of Backup Required Name
RMAN-06252: ---- ----------------------- ----------------------------


RMAN> report need backup days 3 tablespace "test";
RMAN-03022: compiling command: report
RMAN-06270: Report of files whose recovery needs more than 3 days of archived 
logs
RMAN-06271: File Days  Name
RMAN-06272: ---- ----- ----------------------------------------------


p.294
RMAN> report obsolete orphan;
RMAN-03022: compiling command: report
RMAN-06280: Report of obsolete backup sets and datafile copies
RMAN-06281: Type              Recid  Stamp     Filename
RMAN-06282: ----------------  ------ --------- ----------------------
RMAN-06284: Backup Set        7      315573356
RMAN-06285: Backup Piece      7      315573352 AA_CTL315573337.14
RMAN-06284: Backup Set        2      315520283
RMAN-06285: Backup Piece      2      315520280 AA_FULL1ORACLE.4
RMAN-06284: Backup Set        1      315520261
RMAN-06285: Backup Piece      1      315520180 AA_FULL1ORACLE.3
RMAN-06284: Backup Set        6      315572512
RMAN-06285: Backup Piece      6      315572511 AATST_31557250811.1
RMAN-06284: Backup Set        5      315571224
RMAN-06285: Backup Piece      5      315571223 AATST_31557122110.1


RMAN> list copy of database;
RMAN-03022: compiling command: list
RMAN-06210: List of Datafile Copies
RMAN-06211: Key File S Completion time Ckp SCN   Ckp time   Name
RMAN-06212: --- ---- - --------------- --------- --------- ------ 
RMAN-06213: 563 3    D 26-OCT-97       564662    26-OCT-97  C:\ORANT\
                                                            DATABASE\
                                                            RBS1ORCL.ORA
RMAN-06213: 484 5    D 26-OCT-97       564663    26-OCT-97  C:\ORANT\
                                                            DATABASE\
                                                            TST1ORCL.ORA
RMAN-06213: 505 5    D 26-OCT-97       564663    26-OCT-97  C:\ORANT\
                                                            DATABASE\
                                                            TST1ORCL.ORA
RMAN-06213: 525 5    D 26-OCT-97       564663    26-OCT-97  C:\ORANT\
                                                            DATABASE\
                                                            TST1ORCL.ORA
RMAN-06213: 545 5    D 26-OCT-97       564663    26-OCT-97  C:\ORANT\
                                                            DATABASE\
                                                            TST1ORCL.ORA
RMAN-06213: 635 5    D 26-OCT-97       685116    26-OCT-97  C:\ORANT\
                                                            DATABASE\
                                                            TST1ORCL.BAK


p.295
RMAN> list copy of tablespace "rollback_data";
RMAN-03022: compiling command: list
RMAN-06210: List of Datafile Copies
RMAN-06211: Key   File S Completion time Ckp SCN   Ckp time   Name
RMAN-06212: ----- ---- - --------------- --------- ---------  ------
RMAN-06213: 563   3    D 26-OCT-97       564662    26-OCT-97  C:\ORANT\
                                                              DATABASE\ 
                                                              RBS1ORCL.ORA


RMAN> replace script aa_full {
2> allocate channel c1 type disk;
3> backup full filesperset 3
4>    (database format 'aa_full%p%d.%s');
5> }
RMAN-03022: compiling command: replace script
RMAN-03023: executing command: replace script
RMAN-08086: replaced script aa_full



p.296
RMAN> run {
2> execute script aa_full;
3> }
RMAN-03021: executing script: aa_full
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=3 set_stamp=315520175
RMAN-08010: channel c1: including datafile 1 in backupset
RMAN-08010: channel c1: including datafile 2 in backupset
RMAN-08010: channel c1: including datafile 3 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AA_FULL1ORACLE.3 comment=NONE
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=4 set_stamp=315520265
RMAN-08010: channel c1: including datafile 4 in backupset
RMAN-08011: channel c1: including current controlfile in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AA_FULL1ORACLE.4 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.296-297
RMAN> execute script aa_full;
RMAN-00569: ================error message stack follows================
RMAN-00558: error encountered while parsing input commands
RMAN-01005: syntax error: found "execute": expecting one of: "allocate,
 catalog, change, connect, create, delete, exit, host, {, library, list,
 print, register, release, replace, report, reset, resync, rman, rpctest,
 run, set, sql, test"
RMAN-01007: at line 1 column 1
RMAN> run {
2> allocate channel c1 type disk;
3> backup tablespace test;
RMAN-00569: ================error message stack follows================
RMAN-00558: error encountered while parsing input commands
RMAN-01005: syntax error: found "test": expecting one of: "double-quoted-string, identifier, single-quoted-string"
RMAN-01007: at line 3 column 19


p.297
RMAN> run {
2> execute script aa_full;
3> }
RMAN-03021: executing script: aa_full
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=15 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=2 set_stamp=315518537
RMAN-08010: channel c1: including datafile 1 in backupset
RMAN-08010: channel c1: including datafile 2 in backupset
RMAN-08010: channel c1: including datafile 3 in backupset
RMAN-03026: error recovery releasing channel resources
RMAN-08031: released channel: c1
RMAN-00569: ================error message stack follows================
RMAN-03015: error occurred in stored script aa_full
RMAN-03007: retryable error occurred during execution of command: backup
RMAN-07004: unhandled exception during command execution on channel c1
RMAN-10032: unhandled exception during execution of job step 1: ORA-06512: at line 118
RMAN-10035: exception raised in RPC: ORA-19624: operation failed, retry possible
ORA-19502: write error on file "aa_full1ORACLE.2", blockno 32001 (blocksize=512)
ORA-27072: skgfdisp: I/O error
OSD-04008: WriteFile() failure, unable to write to file
O/S-Error: (OS 112) There is not enough space on the disk.
ORA-06512: at "SYS.DBMS_BACKUP_RESTORE", line 399
RMAN-10031: ORA-19624 occurred during call to DBMS_BACKUP_RESTORE.
BACKUPPIECECREATE


p.298
RMAN> create script aa_full {
2> allocate channel c1 type disk;
3> backup full filesperset 3
4>    (database format 'aa_full%p%d.%s');
5> }
RMAN-03022: compiling command: create script
RMAN-03023: executing command: create script
RMAN-03026: error recovery releasing channel resources
RMAN-00569: ================error message stack follows================
RMAN-03006: non-retryable error occurred during execution of command: create script
RMAN-07004: unhandled exception during command execution on channel default
RMAN-10032: unhandled exception during execution of job step 1: ORA-06512: at line 9
RMAN-20401: script already exists


RMAN> list incarnation of database;
RMAN-03022: compiling command: list
RMAN-03025: performing implicit partial resync of recovery catalog
RMAN-03023: executing command: partial resync
RMAN-10030: RPC call appears to have failed to start on channel default
RMAN-10036: RPC call ok on channel default
RMAN-03026: error recovery releasing channel resources
RMAN-00569: ================error message stack follows================
RMAN-00600: internal error, arguments [10053] [1] [] [] []
RMAN-03002: failure during compilation of command
RMAN-03013: command type: list
RMAN-03014: implicit resync of recovery catalog failed
RMAN-03006: non-retryable error occurred during execution of command: partial resync
RMAN-07004: unhandled exception during command execution on channel default
RMAN-10032: unhandled exception during execution of job step 1: ORA-04067: not executed, stored procedure "SYS.DBMS_BACKUP_RESTORE" does not exist
ORA-06512: at line 537
RMAN-10035: exception raised in RPC: ORA-04067: not executed, stored procedure "SYS.DBMS_BACKUP_RESTORE" does not exist
RMAN-10031: ORA-4067 occurred during call to DBMS_BACKUP_RESTORE.GETCKPT


p.299-300
Recovery Manager: Release 8.0.3.0.0 - Production
RMAN-06005: connected to target database: USER22
RMAN-06008: connected to recovery catalog database
RMAN> register database;
RMAN-03022: compiling command: register
RMAN-03023: executing command: register
RMAN-03026: error recovery releasing channel resources
RMAN-00569: ================error message stack follows================
RMAN-03006: non-retryable error occurred during execution of command: register
RMAN-07004: unhandled exception during command execution on channel default
RMAN-10032: unhandled exception during execution of job step 1: ORA-06512: at line 13
RMAN-20002: target database already registered in recovery catalog
RMAN> list incarnation of database;
RMAN-03022: compiling command: list
RMAN-03026: error recovery releasing channel resources
RMAN-00569: ================error message stack follows================
RMAN-03002: failure during compilation of command
RMAN-03013: command type: list
RMAN-03014: implicit resync of recovery catalog failed
RMAN-06038: recovery catalog package detected an error
RMAN-20003: target database incarnation not found in recovery catalog
RMAN> reset database;
RMAN-03022: compiling command: reset
RMAN-03023: executing command: reset
RMAN-08006: database registered in recovery catalog
RMAN-03023: executing command: full resync
RMAN-08029: snapshot controlfile name set to default value: ?/dbs/snapcf_@.f
RMAN-08002: starting full resync of recovery catalog
RMAN-08004: full resync complete
RMAN> list incarnation of database;
RMAN-03022: compiling command: list
RMAN-06240: List of Database Incarnations
RMAN-06241: DB Key  Inc Key DB Name  DB ID       CUR Reset SCN Reset Time
RMAN-06242: ------  ------ ------- ------------- --- --------- ----------
RMAN-06243: 1       2      USER21   603948782    NO  38807     20-OCT-97
RMAN-06243: 1       5      USER22   603948782    YES 38807     20-OCT-97


p.300
C:\ORANT\DATABASE>rman80 target=\"internal/aa@prod\" rcvcat=\"rman/aa@rcv\" msgl
og=\"c:\temp\aarman.log\"


p.300-301
RMAN> run {
2> allocate channel c1 type disk;
3> backup datafile '/vobs/oracle/dbs/t_db2.f'
4> format '/tmp/aa%t';
5> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=10 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=2 set_stamp=316236215
RMAN-08010: channel c1: including datafile 2 in backupset
RMAN-03026: error recovery releasing channel resources
RMAN-08031: released channel: c1
RMAN-00569: ================error message stack follows================
RMAN-03006: non-retryable error occurred during execution of command: backup
RMAN-07004: unhandled exception during command execution on channel c1
RMAN-10032: unhandled exception during execution of job step 1: ORA-06512: at line 84
RMAN-10035: exception raised in RPC: ORA-19583: conversation terminated due to error
ORA-19566: exceeded limit of 0 corrupt blocks for file /vobs/oracle/dbs/t_db2.f
ORA-06512: at "SYS.DBMS_BACKUP_RESTORE", line 399
RMAN-10031: ORA-19583 occurred during call to DBMS_BACKUP_RESTORE.
BACKUPPIECECREATE


p.301
SVRMGR> select * from dept1;
DEPTNO     DNAME          LOC
---------- -------------- -------------
ORA-01578: ORACLE data block corrupted (file # 2, block # 3)
ORA-01110: data file 2: '/vobs/oracle/dbs/t_db2.f'
SVRMGR> select * from v$backup_corruption;
RECID STAMP SET_STAMP SET_COUNT PIECE# FILE# BLOCK# BLOCKS CORRUPTION MAR
----- ----- --------- --------- ------ ----- ------ ------ -------------
0 rows selected.


p.302
RMAN> run {
2> allocate channel c1 type disk;
3> set maxcorrupt for datafile '/vobs/oracle/dbs/t_db2.f' to 5;
3> backup datafile '/vobs/oracle/dbs/t_db2.f'
4> format '/tmp/aa%t';
5> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=10 devtype=DISK
RMAN-03022: compiling command: set
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=3 set_stamp=316238227
RMAN-08010: channel c1: including datafile 2 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=/tmp/aatry316238227 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


SVRMGR> select * from V$backup_corruption;
RECID STAMP SET_STAMP SET_COUNT PIECE# FILE# BLOCK# BLOCKS CORRUPTION MAR
----- ----- --------- --------- ------ ----- ------ ------ ---------- ---
   1  316238233 316238227     3      1     2      3      1          0 YES
1 row selected.


p.312
MTTR = o + cREDO̓Kp + X^oCf[^x[X̃ANeBu + [U[̐؂ւ


p.318
s = obNAbv + Jg̃ÕA[JCu + t@C] + XgA + AvP[ṼA[JCu


p.322
sqlplus <<EOD
connect system/manager
set echo off
set termout off
set feedback off
set heading off
spool backup.sh
SELECT
'svrmgrl <<EOS'||CHR(10)||
'connect internal'||CHR(10)||
'ALTER TABLESPACE '||TABLESPACE_NAME||' BEGIN BACKUP;'||CHR(10)||
'EXIT'||CHR(10)||
'EOS'||CHR(10)||
'compress <'||FILE_NAME||' \$BACKUP'||CHR(10)||
'svrmgrl <<EOS'||CHR(10)||
'connect internal'||CHR(10)||
'ALTER TABLESPACE '||TABLESPACE_NAME||' END BACKUP;'
||CHR(10)||'EXIT'||CHR(10)||
'EOS'||CHR(10)
FROM DBA_DATA_FILES WHERE STATUS = 'AVAILABLE';
spool off
EOD
chmod u+x backup.sh
backup.sh


p.323-324
foreach FILE ($LOG_ARCHIVE_DEST/arch1_*.dbf)
     echo "Backing up archive: $FILE"
     if (! -F $FILE) then
          echo "Error: `$FILE` is not a regular file."
          exit
     end
     cp $FILE $BACKUP
     if ($status == 1) then
          echo "Error: backup failed on archive `$FILE`"
          exit
     end
     cmp -s $FILE $BACKUP/$FILE
     if ($status == 1) then   
          echo "Error: Oracle still using archive `$FILE`"
          rm $BACKUP/$FILE
          exit
     end
     dd if=$FILE | resh $STDBYSITE of=\$BACKUP/$FILE
     if ($status == 1) then
          echo "Error: failed to transfer archive `$FILE`"
          exit
     end
     resh $STDBYSITE cp \$BACKUP/$FILE \$ORACLE_HOME/dbs
     if ($status == 1) then
          echo "Error: restore failed at standby site for archive `$FILE`"
          exit
     end
end


p.331
CREATE OR REPLACE PROCEDURE Note_Latest_Archive AS
  LatestSeqNum INT;
  fno INT;
BEGIN
  SELECT MAX(SEQUENCE#) INTO LatestSeqNum FROM V$LOG
    WHERE ARCHIVED = 'YES';
  fno :=
  UTL_FILE.FOPEN('$LOG_ARCH_DEST', 'latest.arc', 'W');
  UTL_FILE.PUTLINE(fno, LatestSeqNum);
  UTL_FILE.FCLOSE(fno);
END;


VARIABLE jobno INT;
BEGIN
  DBMS_JOB.SUBMIT(:jobno,'note_latest_archive',SYSDATE,'SYSDATE + 1/480');
END;


p.332
while (1)
 set LastApplied = `ls -1 $LOG_ARCHIVE_DEST | tail -1`
  @ LastApplied   = `basename $LastApplied:r | cut -c7-10`
  @ NextToApply   = `expr $LastApplied + 1 `
  @ NewestArchive = `resh $PRIMARYSITE cat $LOG_ARCHIVE_DEST/latest.arc`
  if ( $NextToApply < $NewestArchive ) then
    foreach Archive (`echo $NextToApply $NewestArchive | \
          awk '{for(i=$1;i<=$2;i++) {printf("arch%04.log\n",i)} }' )
      resh $PRIMARYSITE dd if=$LOG_ARCHIVE_DEST/$Archive | \
            resh dd of=$LOG_ARCHIVE/$Archive
      svrmgrl <<EOF
      connect internal
      recover standby database until cancel
      auto
      cancel
      EOF
    end
  end
  sleep 180
end



Chapter6
p.348
ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME CONTROLF LEVEL 10';


p.349
EVENT = "604 TRACE NAME ERRORSTACK FOREVER"

EVENT = "10210 TRACE NAME CONTEXT FOREVER, LEVEL 10"


ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME BLOCKDUMP LEVEL 67109037';

ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME CONTROLF LEVEL 10';

ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME SYSTEMSTATE LEVEL 10';


p.350
alter session set events 'immediate trace name buffers level 1';


alter session set events 'immediate trace name blockdump level 134219181';


p.351
alter session set events 'immediate trace name controlf level 10';


alter session set events 'immediate trace name locks level 5';


alter session set events 'immediate trace name redohdr level 10';


alter session set events 'immediate trace name loghist level 4';


p.352
alter session set events 'immediate trace name file_hdrs level 10';


alter session set events '604 trace name errorstack forever';


alter session set events 'immediate trace name systemstate level 10';


p.353
alter session set events 'immediate trace name coalesce level X'; 


alter session set events 'immediate trace name coalesce level 327680';


p.354
event = "10015 trace name context forever"


event = "10210 trace name context forever, level 10"


p.355
alter session set events '10231 trace name context off';

event = "10231 trace name context forever, level 10"


p.356
_CORRUPTED_ROLLBACK_SEGMENTS =  (rbs1, rbs2)


p.360
oradbx: Release 7.1.3.0.0 - Production on Thu Jan 19 14:13:35 1995
Copyright (c) Oracle Corporation 1979, 1994.  All rights reserved.

(oradbx) help
help                 - print help information
show                 - show status
debug <pid>          - debug process
dump SGA             - dump SGA
dump PGA             - dump PGA
dump stack           - dump call stack
dump core            - dump core without crashing process
dump level 0         - dump error buffer
dump level 1         - level 0 + call stack
dump level 2         - level 1 + process state objects
dump level 3         - level 2 + context area
dump system 1        - brief system states dump
dump system 2        - full system states dump
dump ipc             - dump ipc information
dump controlfile #   - dump control file at level #
dump datafile #      - dump data file header at level #
dump procstat        - dump process statistics
event <event-trace>  - turn on event trace
unlimit trace        - unlimit the size of trace file
exit                 - exit this program
!                    - shell escape


p.361
Oracle Server Manager Release 3.0.3.0.0 - Production
 (c) Copyright 1997, Oracle Corporation.  All Rights Reserved.
Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
SVRMGR> connect internal
Connected.
SVRMGR> oradebug help
HELP           [command]                 Describe one or all commands
SETMYPID                                 Debug current process
SETOSPID       <ospid>                   Set OS pid of process to debug
SETORAPID      <orapid> ['force']        Set Oracle pid of process to debug
DUMP           <dump_name> <level>       Invoke named dump
DUMPSGA        [bytes]                   Dump fixed SGA
DUMPLIST                                 Print a list of available dumps
EVENT          <text>                    Set trace event in process
SESSION_EVENT  <text>                    Set trace event in session
DUMPVAR        <p|s|uga> <name> [level]  Print/dump a fixed PGA/SGA/UGA variable
SETVAR         <p|s|uga> <name> <value>  Modify a fixed PGA/SGA/UGA variable
PEEK           <addr> <len> [level]      Print/Dump memory
POKE           <addr> <len> <value>      Modify memory
WAKEUP         <orapid>                  Wake up Oracle process
SUSPEND                                  Suspend execution
RESUME                                   Resume execution
FLUSH                                    Flush pending writes to trace file
TRACEFILE_NAME                           Get name of trace file
CORE                                     Dump core without crashing process
IPC                                      Dump ipc information
UNLIMIT                                  Unlimit the size of the trace file
PROCSTAT                                 Dump process statistics
CALL           <func> [arg1] ... [argn]  Invoke function with arguments
SVRMGR> oradebug setospid 9431
Oracle pid: 12, Unix process pid: 9431, image: oraclevk803
SVRMGR> oradebug unlimit
Statement processed.
SVRMGR> oradebug event 10046 trace name context forever, level 12
Statement processed.
SVRMGR> oradebug flush
Statement processed.


p.364
ORA-01130: data file version num incompatible with ORACLE Version num.


p.372
   CHECKPOINT PROGRESS RECORDS:
     (blkno = 0x3, size = 104, max = 1, in-use = 1, last-recid= 0)
THREAD #1 - status:0x2 flags:0x0 dirty:0
low cache rba:(0xffffffff.ffffffff.ffff) on disk rba:(0x109.a.0)
on disk scn: 0x0000.000125db 11/03/97 22:24:56


p.378
TABLESPACE RECORDS:
     (blkno = 0x23, size = 68, max = 32, in-use = 2, last-recid = 2)
TABLESPACE #0 SYSTEM: recno=1
 First datafile link=1  Number of rollback segments=0
 Tablespace PITR mode start scn: 0x0000.00000000 01/01/88 00:00:00
 Tablespace PITR last completion scn: 0x0000.00000000 01/01/88
 00:00:00
TABLESPACE #1 USERS: recno=2


   OFFLINE RANGE RECORDS:
     (blkno = 0x4b, size = 56, max = 36, in-use = 3, last-recid= 3)
Earliest record:
 ......
Latest record:
 RECID #3 Recno 3 Record timestamp  10/27/97 17:38:18 File=4 Link-Recid=2
 Offline scn: 0x0000.00036dbf
 Online checkpointed at scn: 0x0000.00036dc3 10/01/97 20:54:33
 thread:1 rba:(0x151.dd.bc)
 
 
p.379
    BACKUP SET RECORDS:
     (blkno = 0x49, size = 40, max = 50, in-use = 2, last-recid= 2)
Earliest record:
......
Latest record:
 RECID #2 Recno 2 Record timestamp  11/03/97 04:03:25
  Backup set key: stamp=316238602, count=4
  Backup contains: <full datafiles>
  Backup set is NOT part of the incremental strategy
  Blocksize=2048 Piece-Count=1 Level=0 Time:
  
  
   BACKUP PIECE RECORDS:
     (blkno = 0x4a, size = 736, max = 66, in-use = 2, last-recid= 2)
Earliest record:
......
Latest record:
 RECID #2 Recno 2 Record timestamp  11/03/97 04:03:22 piece #1
  Backup set key: stamp=316238602, count=4
  Flags: <concurrent access>
  Device: DISK
  Handle: /tmp/aausr316238602.4
  Media-Handle: 
  Comment: 
  Tag:


p.380
   BACKUP DATAFILE RECORDS:
     (blkno = 0x62, size = 116, max = 69, in-use = 2, last-recid= 2)
Earliest record:
......
Latest record:
 RECID #2 Recno 2 Record timestamp  11/03/97 04:03:25 File=2 Incremental backup level=0
  File is NOT part of the incremental strategy
  Backup set key: stamp=316238602, count=4
  Creation checkpointed at scn: 0x0000.000083a6 11/03/97 02:46:54
  File header checkpointed at scn: 0x0000.0000d7ac 11/03/97 04:03:22
  Resetlogs scn and time scn: 0x0000.00000001 08/18/97 06:24:33
  Incremental Change scn: 0x0000.00000000
  Absolute Fuzzy scn: 0x0000.00000000
  Newly-marked media corrupt blocks  1 Total media corrupt blocks 1
  Total logically corrupt blocks 0  Block images written to backup 22
  Blocks scanned for backup 5120  Block size 2048
  Low Offline Range Recid 0


p.381
   DATAFILE COPY RECORDS:
     (blkno = 0x23a, size = 660, max = 64, in-use = 3, last-recid= 3)
Earliest record:
.......
Latest record:
 RECID #3 Recno 3 Record timestamp  11/05/97 19:42:17
  File=4 (4) database id=1189248130 block size=2048
  Flags: <deleted>
  Filename: C:\TEMP\TST.BAK
  Creation checkpointed at scn: 0x0000.00003c4c 11/02/97 11:09:27
  File header checkpointed at scn: 0x0000.0002ae03 11/05/97 19:42:15
  Resetlogs scn and time scn: 0x0000.00000001 11/02/97 09:11:30
  Recovery Fuzzy scn and time scn: 0x0000.00000000 01/01/88 00:00:00
  Absolute Fuzzy scn: 0x0000.00000000
  Newly-marked media corrupt blocks 0  Total media corrupt blocks 0
  Total logically corrupt blocks 0 Block images written to backup 512
  Low Offline Range Recid 0


BACKUP DATAFILE CORRUPTION RECORDS:
     (blkno = 0x7e, size = 44, max = 46, in-use = 2, last-recid= 2)
Earliest record:
.......
Latest record:
 RECID #2 Recno 2 Record timestamp  11/03/97 04:03:25 File=2 Piece #1 Starting block #3 Block count=1
  Backup set key: stamp=316238602, count=4
  Flags: <newly corrupt>
  For logically corrupt block: scn of corrupting change: scn: 0x0000.00000000
 RECID #1 Recno 1 Record timestamp  11/03/97 03:57:13 File=2 Piece #1 Starting block #3 Block count=1
  Backup set key: stamp=316238227, count=3
  Flags: <newly corrupt>
  For logically corrupt block: scn of corrupting change: scn: 0x0000.00000000


p.382
   DELETION RECORDS:
     (blkno = 0x251, size = 20, max = 1619, in-use = 3, last-recid= 3)
Earliest record:
......
Latest record:
 RECID #3 Recno 3 Record timestamp  11/05/97 19:42:45
  Object type=16  Object recid=3  Object timestamp=3 11/05/97 19:42:17
......


p.384
ALTER SYSTEM DUMP LOGFILE 'filename' option option...;
option  =  rba min seqno . blockno |
           rba max seqno . blockno |
           dba min fileno . blockno |
           dba max fileno . blockno |
           time min value |
           time max value |
           layer value |
           opcode value


p.385
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> update backup set c2 = 'phy_backup';
2 rows processed.
SVRMGR> commit;
Statement processed.
SVRMGR> select * from backup;
C1       C2
----     ----
1        phy_backup
2        phy_backup
2 rows selected.
SVRMGR> archive log list
Database log mode          No Archive Mode 
Automatic archival         Enabled
Archive destination        C:\ORACLE7\RDBMS70\ARCHIVE
Oldest online log sequence 8
Current log sequence       9
SVRMGR> alter system dump logfile 'C:\ORACLE7\DBS\wdblog2.log';
Statement processed.
SVRMGR> exit


p.391
SVRMGR> select * from backup;
C1       C2
----     ----
1        log_backup
2        phy_backup
2 rows selected.
SQLDBA> alter session set events 'immediate trace name blockdump level 33554650';
Statement processed.


p.394
ORA-01135 file name accessed for DML/query is off-line


ORA-01545 rollback segment #'name' was not available


p.396
SQL> SELECT FILE_ID, BLOCK_ID, BLOCKS, BYTES FROM
2 > SYS.DBA_FREE_SPACE WHERE TABLESPACE_NAME='users';

FILE_ID   BLOCK_ID   BLOCKS   BYTES
--------  ---------  -------  -------
4         2          20       40960
4         1465       72       147456
4         22         25       51200
4         147        1318     2699264

4 rows selected.


SQL> SELECT FILE_ID, BLOCK_ID, BLOCKS, BYTES FROM
2 > DBA_FREE_SPACE WHERE TABLESPACE_NAME='users'
3 > ORDER BY BLOCK_ID;

FILE_ID   BLOCK_ID   BLOCKS   BYTES
--------  ---------  -------  -------
4         2          20       40960
4         22         25       51200
4         147        1318     2699264
4         1465       72       147456

4 rows selected.


p.397
SQL> CREATE TABLE bulletin (y NUMBER) STORAGE (INITIAL 2650K)
2 > TABLESPACE users;

Table created.

SQL> SELECT FILE_ID, BLOCK_ID, BLOCKS, BYTES FROM
2 > DBA_FREE_SPACE WHERE TABLESPACE_NAME='users'
3 > ORDER BY BLOCK_ID;

FILE_ID  BLOCK_ID  BLOCKS  BYTES
-------  --------  ------  -----
4        2         45      92160
4        1472      65      133120

2 rows selected.


SQL> DROP TABLE bulletin;

Table dropped.

SQL> SELECT FILE_ID, BLOCK_ID, BLOCKS, BYTES FROM
2 > DBA_FREE_SPACE WHERE TABLESPACE_NAME='users'
3 > ORDER BY BLOCK_ID;

FILE_ID  BLOCK_ID  BLOCKS  BYTES
-------  --------  ------  -----
4        2         45      92160
4        147       1325    2713600
4        1472      65      133120

3 rows selected.


p.398
SELECT MAX(BLOCKS) FROM SYS.DBA_FREE_SPACE WHERE TABLESPACE_NAME='name';


SELECT SUM(BLOCKS) FROM SYS.DBA_FREE_SPACE WHERE TABLESPACE_NAME='name';


p.399
01650, 00000, "unable to extend rollback segment %s by %s in tablespace %s"
// *Cause:  Failed to allocate an extent for rollback segment in tablespace.
// *Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more
//         files to the tablespace indicated.


SELECT TEMPORARY_TABLESPACE FROM SYS.DBA_USERS WHERE USERNAME = 'username';


SELECT INITIAL_EXTENT, NEXT_EXTENT, MIN_EXTENTS, PCT_INCREASE FROM SYS.DBA_TABLESPACES WHERE TABLESPACE_NAME='name';


ALTER TABLESPACE name DEFAULT STORAGE (INITIAL xxx NEXT yyy);


ALTER USER username TEMPORARY TABLESPACE new_tablespace_name;


p.400
ALTER TABLESPACE tablespace_name ADD DATAFILE 'filename' SIZE size_of_file;


SELECT FILE_NAME FROM SYS.DBA_DATA_FILES WHERE TABLESPACE_NAME='name';


p.406
Select log, oldest, youngest+1/86400
from mlog$ where master = :2 and mowner = :1 for update;


Select oldest into oldest from sys.mlog$ where mowner = mow and master = mas;


p.407
create table foo (a varchar(30));

declare
owner varchar(30);
master varchar(30);
log varchar(30);
snapshot date;
snaptime date;
begin
    snapshot := SYSDATE;
    snaptime := SYSDATE;
    owner := 'SCOTT';
    master := 'EMP';
    dbms_snapshot.set_updblink(owner, master, log, snapshot, snaptime);
    insert into foo(a) values (log); 
end;


SVRMGR> select * from foo;
A
--------------------
MLOG$_EMP
1 row selected.


p.408
/* f[^x[Xt@C# FCubN# B擾邽߂̋[R[h */

get(F,B)
Begin
     If (F > MAX_NUMBER_OF_FILES)
          signal ("ORA 600 [2858] [F]");
          exit ( )
     endif;
     ......
end


p.412
select event, count(*) from  V$SESSION_WAIT group by event;


select p2, count(*) from V$SESSION_WAIT where event = 'latch free'
group by p2;


p.415
ORA-00600 [3339] [arg1] [arg2] [] [] [] []
ORA-1578: Data block corrupted in file # x block # y


p.417
Select distinct(key) from corrupt_table
where key > (lowest value for the key)
and substr(rowid,1,8) = corrupt_block_id
order by 1;


p.418
Create new_table as select * from corrupt_table
where key > (lowest value for the key)
and key NOT IN (key list) 


Select /*+ use descending scan on index */ *
from corrupt_table where key = 'duplicate key' and
rownum < 4;



Chapter7
p.421
ORA-01157: cannot identify data file 4 - file not found
ORA-01110: data file 4: 'd:\orant\database\usr1orcl.ora'


p.423
SVRMGR> create table case1 (c1 number) tablespace user_data;
Statement processed.
SVRMGR> insert into case1 values (1);
1 row processed.
SVRMGR> commit;
Statement processed.
SVRMGR> select tablespace_name, file_name, status from dba_data_files where
     2> tablespace_name = 'USER_DATA';
TABLESPACE_NAME           FILE_NAME                         STATUS
------------------------- -------------------               ---------
USER_DATA                 D:\ORANT\DATABASE\USR1ORCL.ORA    AVAILABLE
1 row selected.
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host del d:\orant\database\usr1orcl.ora


p.425
SVRMGR> select * from case;
select * from case1
              *
ORA-00942: table or view does not exist


p.426-428
C:\ORANT\DATABASE>svrmgr30
Oracle Server Manager Release 3.0.3.0.0 - Production
(c) Copyright 1997, Oracle Corporation.  All Rights Reserved.
Oracle8 Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
SVRMGR> connect internal
Password:
Connected.
SVRMGR> startup mount
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            C:\ORANT\database\archive
Oldest online log sequence     46
Next log sequence to archive   47
Current log sequence           47
SVRMGR> alter database noarchivelog;
Statement processed.
SVRMGR> alter database open;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.
C:\ORANT\DATABASE>del tmp1orcl.ora
C:\ORANT\DATABASE>exit
SVRMGR> startup mount
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
SVRMGR> alter database open;
alter database open
*
ORA-01157: cannot identify data file 4 - file not found
ORA-01110: data file 4: 'C:\ORANT\DATABASE\TMP1ORCL.ORA'
SVRMGR> alter database datafile 'c:\orant\database\tmp1orcl.ora' offline;
alter database datafile 'c:\orant\database\tmp1orcl.ora' offline
*
ORA-01145: offline immediate disallowed unless media recovery enabled
SVRMGR> alter database archivelog;
alter database archivelog
*
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode
SVRMGR> alter database datafile 'c:\orant\database\tmp1orcl.ora' offline drop;
Statement processed.
SVRMGR> alter database open;
Statement processed.
SVRMGR> drop tablespace temporary_data including contents;
Statement processed.
SVRMGR> create tablespace temporary_data datafile 'c:\orant\database\tmp1orcl.ora' size 1m;
Statement processed.


p.428
SVRMGR> alter database datafile 'c:\orant\database\tmp1orcl.ora' offline;


p.429
ORA-01147: SYSTEM tablespace file 1 is offline

ORA-01110: data file 1: 'DISK$WR3:[RDBMSPT.ORACLE.DATA]SYSTEM.DBS'


p.430
RMAN> run {
2> allocate channel c1 type disk;
3> backup database filesperset 3
4> format 'aa_full%t.%s';
5> }
RMAN-08031: released channel: c1
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=14 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=2 set_stamp=318296969
RMAN-08010: channel c1: including datafile 1 in backupset
RMAN-08010: channel c1: including datafile 2 in backupset
RMAN-08010: channel c1: including datafile 3 in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AA_FULL318296969.2 comment=NONE
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=3 set_stamp=318297039
RMAN-08011: channel c1: including current controlfile in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AA_FULL318297039.3 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.431
SVRMGR> startup
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
ORA-01157: cannot identify data file 1 - file not found
ORA-01110: data file 1: 'C:\ORANT\DATABASE\SYS1ORCL.ORA'


p.431-432
D:\ORANT\DATABASE> rman80 target=\"internal/oracle@prod\" rcvcat=\"rman/rman@rcv\"
Recovery Manager: Release 8.0.3.0.0 - Production
RMAN-06005: connected to target database: ORACLE
RMAN-06008: connected to recovery catalog database
RMAN> run {
2> allocate channel c1 type disk;
3> restore tablespace "system";
4> recover tablespace "system";
5> sql 'alter database open';
6> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=12 devtype=DISK
RMAN-03022: compiling command: restore
RMAN-03023: executing command: restore
RMAN-08016: channel c1: starting datafile backupset restore
RMAN-08502: set_count=2 set_stamp=318296969
RMAN-08019: channel c1: restoring datafile 1
RMAN-08509: destination for restore of datafile 1: C:\ORANT\DATABASE\SYS1ORCL.ORA
RMAN-08023: channel c1: restored backup piece 1
RMAN-08511: piece handle=AA_FULL318296969.2 params=NULL
RMAN-08024: channel c1: restore complete
RMAN-03023: executing command: partial resync
RMAN-03022: compiling command: recover
RMAN-03022: compiling command: recover(1)
RMAN-03022: compiling command: recover(2)
RMAN-03022: compiling command: recover(3)
RMAN-03023: executing command: recover(3)
RMAN-08054: starting media recovery
RMAN-08055: media recovery complete
RMAN-03022: compiling command: recover(4)
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: sql
RMAN-06162: sql statement: alter database open
RMAN-03023: executing command: sql
RMAN-06162: sql statement: alter database open
RMAN-03023: executing command: sql
RMAN-08031: released channel: c1


p.432
RMAN> run {
2> allocate channel c1 type disk;
3> copy datafile 'c:\orant\database\sys1orcl.ora' to 'd:\temp\sys1orcl.bak';
4> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=12 devtype=DISK
RMAN-03022: compiling command: copy
RMAN-03023: executing command: copy
RMAN-08000: channel c1: copied datafile 1
RMAN-08501: output filename=D:\TEMP\SYS1ORCL.BAK recid=2 stamp=318298021
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.433
RMAN> run {
2> allocate channel c1 type disk;
3> restore (datafile 1) from datafilecopy;
4> recover tablespace "system";
5> sql 'alter database open';
6> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=12 devtype=DISK
RMAN-03022: compiling command: restore
RMAN-03023: executing command: restore
RMAN-08019: channel c1: restoring datafile 1
RMAN-08507: input datafilecopy recid=2 stamp=318298021 filename=D:\TEMP\SYS1ORCL.BAK
RMAN-08509: destination for restore of datafile 1: C:\ORANT\DATABASE\SYS1ORCL.ORA
RMAN-08007: channel c1: copied datafilecopy of datafile 1
RMAN-08501: output filename=C:\ORANT\DATABASE\SYS1ORCL.ORA recid=3 stamp=318298232
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: recover
RMAN-03022: compiling command: recover(1)
RMAN-03022: compiling command: recover(2)
RMAN-03022: compiling command: recover(3)
RMAN-03023: executing command: recover(3)
RMAN-08054: starting media recovery
RMAN-08055: media recovery complete
RMAN-03022: compiling command: recover(4)
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: sql
RMAN-06162: sql statement: alter database open
RMAN-03023: executing command: sql
RMAN-08031: released channel: c1


p.435-436
C:\ORANT\DATABASE>svrmgr30
Oracle Server Manager Release 3.0.3.0.0 - Production
(c) Copyright 1997, Oracle Corporation.  All Rights Reserved.
Oracle8 Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
SVRMGR> connect internal
Password:
Connected.
SVRMGR> create table case4(c1 number) tablespace user_data;
Statement processed.
SVRMGR> insert into case4 values(1);
1 row processed.
SVRMGR> insert into case4 values(2);
1 row processed.
SVRMGR> commit;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.
C:\ORANT\DATABASE>del usr1orcl.ora
C:\ORANT\DATABASE>copy backup\usr1orcl.ora
        1 file(s) copied.
C:\ORANT\DATABASE>exit
SVRMGR> startup
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
ORA-01113: file 2 needs media recovery
ORA-01110: data file 2: 'C:\ORANT\DATABASE\USR1ORCL.ORA'


p.436-437
SVRMGR> startup mount
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
SVRMGR> recover database;
ORA-00279: change 319914 generated at 10/15/97 23:21:08 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000055.ARC
ORA-00280: change 319914 for thread 1 is in sequence #55
 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
<enter>
Log applied.
ORA-00279: change 319948 generated at 10/15/97 23:51:42 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000056.ARC
ORA-00280: change 319948 for thread 1 is in sequence #56
ORA-00278: log file 'C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000055.ARC' no longer needed for this recovery
 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
Log applied.
ORA-00279: change 339951 generated at 10/15/97 23:55:17 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000057.ARC
ORA-00280: change 339951 for thread 1 is in sequence #57
ORA-00278: log file 'C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000056.ARC' no longer needed for this recovery
 Log applied.
Media recovery complete.
SVRMGR> alter database open;
Statement processed.
SVRMGR> select * from case4;
C1
----------
         1
         2
2 rows selected.


p.437-438
SVRMGR> startup mount;
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
SVRMGR> alter database open;
ORA-01113: file 2 needs media recovery
ORA-01110: data file 2: 'C:\ORANT\DATABASE\USR1ORCL.ORA'
SVRMGR> alter database archivelog;
Statement processed.
SVRMGR> alter database datafile 'c:\orant\database\usr1orcl.ora' offline;
Statement processed.
SVRMGR> alter database open;
Statement processed.
SVRMGR> recover datafile 'c:\orant\database\usr1orcl.ora';
ORA-00279: change 319914 generated at 10/15/97 23:21:08 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000055.ARC
ORA-00280: change 319914 for thread 1 is in sequence #55
 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
Media recovery complete.
SVRMGR> alter database datafile 'c:\orant\database\usr1orc1.ora' online;
Statement processed.
SVRMGR> select * from case4;
C1
----------
         1
         2
2 rows selected.


p.438-439
SVRMGR> startup mount
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
SVRMGR> alter database archivelog;
Statement processed.
SVRMGR> alter database open;
alter database open
*
ORA-01113: file 2 needs media recovery
ORA-01110: data file 2: 'C:\ORANT\DATABASE\USR1ORCL.ORA'
SVRMGR> alter database datafile 'c:\orant\database\usr1orcl.ora' offline;
Statement processed.
SVRMGR> alter database open;
Statement processed.
SVRMGR> alter tablespace user_data offline;
Statement processed.
SVRMGR> recover tablespace user_data;
ORA-00279: change 319914 generated at 10/15/97 23:21:08 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000055.ARC
ORA-00280: change 319914 for thread 1 is in sequence #55
 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
Log applied.
Media recovery complete.
SVRMGR> select * from case4;
C1
----------
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2: 'C:\ORANT\DATABASE\USR1ORCL.ORA'
SVRMGR> alter tablespace user_data online;
Statement processed.
SVRMGR> select * from case4;
C1
----------
         1
         2
2 rows selected.


p.439
RMAN> run {
2> recover tablespace "user_data";
3> }
RMAN-03022: compiling command: recover
RMAN-03025: performing implicit partial resync of recovery catalog
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: recover(1)
RMAN-03022: compiling command: recover(2)
RMAN-03026: error recovery releasing channel resources
RMAN-00569: ================error message stack follows================
RMAN-03002: failure during compilation of command
RMAN-03013: command type: recover
RMAN-03002: failure during compilation of command
RMAN-03013: command type: recover(2)
RMAN-06094: datafile 2 must be restored


p.439-440
RMAN> run {
> allocate channel c1 type disk;
> restore (datafile 2);
> recover tablespace "user_data";
> sql 'alter tablespace user_data online';
> }
MAN-03022: compiling command: allocate
MAN-03023: executing command: allocate
MAN-08030: allocated channel: c1
MAN-08500: channel c1: sid=17 devtype=DISK
MAN-03022: compiling command: restore
MAN-03023: executing command: restore
MAN-08016: channel c1: starting datafile backupset restore
MAN-08502: set_count=6 set_stamp=315562781
MAN-08019: channel c1: restoring datafile 2
MAN-08509: destination for restore of datafile 5: C:\ORANT\DATABASE\USR1ORCL.ORA
MAN-08023: channel c1: restored backup piece 1
MAN-08511: piece handle=AA_FULL1ORACLE.6 params=NULL
MAN-08024: channel c1: restore complete
MAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: recover
RMAN-03022: compiling command: recover(1)
RMAN-03022: compiling command: recover(2)
RMAN-03022: compiling command: recover(3)
RMAN-03023: executing command: recover(3)
RMAN-08054: starting media recovery
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000381.A
RC thread=1 sequence=381
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000382.A
RC thread=1 sequence=382
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000383.A
RC thread=1 sequence=383
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000384.A
RC thread=1 sequence=384
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000385.A
RC thread=1 sequence=385
RMAN-08055: media recovery complete
RMAN-03022: compiling command: recover(4)
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: sql
RMAN-06162: sql statement: alter tablespace user_data online
RMAN-03023: executing command: sql
RMAN-08031: released channel: c1


p.441
RMAN> run {
2> allocate channel c1 type disk;
3> copy datafile 'c:\orant\database\usr1orcl.ora' to 'd:\temp\usr1orcl.bak';
4> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=13 devtype=DISK
RMAN-03022: compiling command: copy
RMAN-03025: performing implicit partial resync of recovery catalog
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03023: executing command: copy
RMAN-08000: channel c1: copied datafile 2
RMAN-08501: output filename=D:\TEMP\USR1ORCL.BAK recid=8 stamp=316023468
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.441-442
RMAN> run {
2> allocate channal c1 type disk;
3> restore (datafile 2) from datafilecopy;
4> recover tablespace "user_data";
5> sql 'alter database open';
6> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=13 devtype=DISK
RMAN-03022: compiling command: restore
RMAN-03025: performing implicit partial resync of recovery catalog
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03023: executing command: restore
RMAN-08019: channel c1: restoring datafile 2
RMAN-08507: input datafilecopy recid=8 stamp=316023468 filename=D:\TEMP\USR1ORCL.BAK
RMAN-08509: destination for restore of datafile 2: C:\ORANT\DATABASE\USR1ORCL.ORA
RMAN-08007: channel c1: copied datafilecopy of datafile 2
RMAN-08501: output filename=C:\ORANT\DATABASE\USR1ORCL.ORA recid=11 stamp=316024158
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: recover
RMAN-03022: compiling command: recover(1)
RMAN-03022: compiling command: recover(2)
RMAN-03022: compiling command: recover(3)
RMAN-03023: executing command: recover(3)
RMAN-08054: starting media recovery
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000585.ARC thread=1 sequence=585
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000586.ARC thread=1 sequence=586
RMAN-08055: media recovery complete
RMAN-03022: compiling command: recover(4)
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: sql
RMAN-06162: sql statement: alter database open
RMAN-03023: executing command: sql
RMAN-08031: released channel: c1


p.444
ORA-00376: file 2 cannot be read at this time


p.445
C:\ORANT\DATABASE>svrmgr30
Oracle Server Manager Release 3.0.3.0.0 - Production
(c) Copyright 1997, Oracle Corporation.  All Rights Reserved.
Oracle8 Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
SVRMGR> connect internal
Password:
Connected.
SVRMGR> create table case5 (c1 number) tablespace user_data;
Statement processed.
SVRMGR> select * from case5;
C1
----------
0 rows selected.
SVRMGR> set transaction use rollback segment rb1;
Statement processed.
SVRMGR> insert into case5 values(5);
1 row processed.
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> exit
C:\ORANT\DATABASE>del rbs1orcl.ora
C:\ORANT\DATABASE>copy backup\rbs1orcl.ora
        1 file(s) copied.


p.445-448
C:\ORANT\DATABASE>svrmgr30
Oracle Server Manager Release 3.0.3.0.0 - Production
(c) Copyright 1997, Oracle Corporation.  All Rights Reserved.
Oracle8 Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
SVRMGR> connect internal
Password:
Connected.
SVRMGR> startup mount;
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
SVRMGR> alter database datafile 'C:\orant\database\rbs1orcl.ora' offline;
Statement processed.
SVRMGR> alter database open;
Statement processed.
SVRMGR> create rollback segment temp1 tablespace system;
Statement processed.
SVRMGR> create rollback segment temp2 tablespace system;
Statement processed.
SVRMGR> alter rollback segment temp1 online;
Statement processed.
SVRMGR> alter rollback segment temp2 online;
Statement processed.
SVRMGR> select * from case5;
C1
----------
ORA-00376: file 3 cannot be read at this time
ORA-01110: data file 3: 'C:\ORANT\DATABASE\RBS1ORCL.ORA'
SVRMGR> select segment_name, status from dba_rollback_segs;
SEGMENT_NAME                   STATUS
------------------------------ ----------------
SYSTEM                         ONLINE
RB_TEMP                        OFFLINE
RB1                            NEEDS RECOVERY
RB2                            NEEDS RECOVERY
RB3                            NEEDS RECOVERY
RB4                            NEEDS RECOVERY
RB5                            NEEDS RECOVERY
RB6                            NEEDS RECOVERY
RB7                            NEEDS RECOVERY
RB8                            OFFLINE
RB9                            OFFLINE
RB10                           OFFLINE
RB11                           OFFLINE
RB12                           OFFLINE
RB13                           OFFLINE
RB14                           OFFLINE
RB15                           OFFLINE
RB16                           OFFLINE
TEMP1                          ONLINE
TEMP2                          ONLINE
20 rows selected.
SVRMGR> recover tablespace rollback_data;
ORA-00279: change 319914 generated at 10/15/97 23:21:08 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000055.ARC
ORA-00280: change 319914 for thread 1 is in sequence #55
 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
Log applied.
ORA-00279: change 339951 generated at 10/15/97 23:55:17 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000057.ARC
ORA-00280: change 339951 for thread 1 is in sequence #57
ORA-00278: log file 'C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000056.ARC' no 
longer needed for this recovery
 Log applied.
ORA-00279: change 359990 generated at 10/16/97 15:42:48 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000058.ARC
ORA-00280: change 359990 for thread 1 is in sequence #58
ORA-00278: log file 'C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000057.ARC' no 
longer needed for this recovery
 Log applied.
ORA-00279: change 380035 generated at 10/16/97 16:04:22 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000059.ARC
ORA-00280: change 380035 for thread 1 is in sequence #59
ORA-00278: log file 'C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000058.ARC' no longer needed for this recovery
 Log applied.
Media recovery complete.
SVRMGR> select * from case5;
C1
----------
ORA-00376: file 3 cannot be read at this time
ORA-01110: data file 3: 'C:\ORANT\DATABASE\RBS1ORCL.ORA'
SVRMGR> alter tablespace rollback_data online;
Statement processed.
SVRMGR> select * from case5;
C1
----------
0 rows selected.
SVRMGR> select segment_name,status from dba_rollback_segs;
SEGMENT_NAME                   STATUS
------------------------------ ----------------
SYSTEM                         ONLINE
RB_TEMP                        OFFLINE
RB1                            NEEDS RECOVERY
RB2                            NEEDS RECOVERY
RB3                            NEEDS RECOVERY
RB4                            NEEDS RECOVERY
RB5                            NEEDS RECOVERY
RB6                            NEEDS RECOVERY
RB7                            NEEDS RECOVERY
RB8                            OFFLINE
RB9                            OFFLINE
RB10                           OFFLINE
RB11                           OFFLINE
RB12                           OFFLINE
RB13                           OFFLINE
RB14                           OFFLINE
RB15                           OFFLINE
RB16                           OFFLINE
TEMP1                          ONLINE
TEMP2                          ONLINE
20 rows selected.
SVRMGR> alter rollback segment rb1 online;
Statement processed.
SVRMGR> alter rollback segment rb2 online;
Statement processed.
SVRMGR> alter rollback segment rb3 online;
Statement processed.
SVRMGR> alter rollback segment rb4 online;
Statement processed.
SVRMGR> alter rollback segment rb5 online;
Statement processed.
SVRMGR> alter rollback segment rb6 online;
Statement processed.
SVRMGR> alter rollback segment rb7 online;
Statement processed.
SVRMGR> alter rollback segment temp1 offline;
Statement processed.
SVRMGR> alter rollback segment temp2 offline;
Statement processed.
SVRMGR> drop rollback segment temp1;
Statement processed.
SVRMGR> drop rollback segment temp2;
Statement processed.


p.448-450
RMAN> run {
2> allocate channel c1 type disk;
3> restore (datafile 3);
4> recover tablespace "rollback_data";
5> sql 'alter tablespace rollback_data online';
6> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: restore
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: restore
RMAN-03023: executing command: restore
RMAN-08016: channel c1: starting datafile backupset restore
RMAN-08502: set_count=5 set_stamp=315562680
RMAN-08019: channel c1: restoring datafile 3
RMAN-08509: destination for restore of datafile 3: C:\ORANT\DATABASE\RBS1ORCL.ORA
MAN-08023: channel c1: restored backup piece 1
MAN-08511: piece handle=AA_FULL1ORACLE.6 params=NULL
RMAN-08024: channel c1: restore complete
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: recover
RMAN-03022: compiling command: recover(1)
RMAN-03022: compiling command: recover(2)
RMAN-03022: compiling command: recover(3)
RMAN-03023: executing command: recover(3)
RMAN-08054: starting media recovery
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000381.A
RC thread=1 sequence=381
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000382.A
RC thread=1 sequence=382
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000383.A
RC thread=1 sequence=383
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000384.A
RC thread=1 sequence=384
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000385.A
RC thread=1 sequence=385
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000386.A
RC thread=1 sequence=386
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000387.A
RC thread=1 sequence=387
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000388.A
RC thread=1 sequence=388
RMAN-08055: media recovery complete
RMAN-03022: compiling command: recover(4)
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: sql
RMAN-06162: sql statement: alter tablespace rollback_data online
RMAN-03023: executing command: sql
RMAN-08031: released channel: c1


p.451-452
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> exit
Server Manager complete.
cosmos% rm /home/orahome/data/733/*.log
cosmos%  cp /home/orahome/backup/*.dbf /home/orahome/data/733
cosmos% svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
With the distributed, replication, parallel query and Spatial Data options
PL/SQL Release 2.3.3.0.0 - Production
SVRMGR> connect internal
Connected.
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> recover database until cancel;

ORA-00279: Change 6232 generated at 02/03/95 08:45:58 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/733/dbs/arch1_50.dbf
ORA-00280: Change 6232 for thread 1 is in sequence #50
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
enter
Applying suggested logfile...
Log applied.
ORA-00279: Change 6269 generated at 02/03/95 19:46:32 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/733/dbs/arch1_51.dbf
ORA-00280: Change 6269 for thread 1 is in sequence #51
ORA-00278: Logfile '/home/orahome/product/733/dbs/arch1_50.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
enter
Applying suggested logfile...
Log applied.

..........(52`55̃Ot@C̓Kp)


p.452-453
ORA-00279: Change 6310 generated at 02/03/95 22:55:43 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/733/dbs/arch1_56.dbf
ORA-00280: Change 6310 for thread 1 is in sequence #56
ORA-00278: Logfile '/home/orahome/product/733/dbs/arch1_55.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
cancel
Media recovery cancelled.
SVRMGR> alter database open resetlogs;
Statement processed.
SVRMGR> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR> exit
 cosmos% ls
control01.ctl  rbs01.dbf   redo03.log    test1.dbf
control02.ctl  redo01.log  system01.dbf  tools01.dbf
control03.ctl  redo02.log  temp.dbf      users01.dbf


p.454
alter database datafile 'file_name' end backup;


p.454-455
cosmos% svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
With the distributed, replication, parallel query and Spatial Data options
PL/SQL Release 2.3.3.0.0 - Production

SVRMGR> connect internal
Connected.
SVRMGR> startup
ORACLE instance started.
Database mounted.
Database opened.

Total System Global Area       4481448 bytes
   Fixed Size                    47152 bytes
   Variable Size               4016504 bytes
   Database Buffers             409600 bytes
   Redo Buffers                   8192 bytes

SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/orahome/product/7.3.3/dbs/arch
Oldest online log sequence     53
Next log sequence to archive   55
Current log sequence           55

SVRMGR> alter tablespace test begin backup;
Statement processed.
SVRMGR> host
cosmos% cp /home/orahome/data/733/test1.dbf /home/orahome/backup/hot
cosmos% exit
SVRMGR> create table case7 (c1 number) tablespace test;
Statement processed.
SVRMGR> insert into case7 values(7);
Statement processed.
SVRMGR> commit;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> shutdown abort
ORACLE instance shut down.


p.456
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> alter database open;
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: '/home/orahome/data/733/test1.dbf'
SVRMGR> alter database datafile 
'/home/orahome/data/733/test1.dbf' end backup;
Statement processed.
SVRMGR> alter database open;
Statement processed.
SVRMGR> select * from case7;
C1
----------
         7
1 row selected.


p.456
cosmos% rm /home/orahome/data/733/test1.dbf
cosmos% cp /home/orahome/backup/hot/test1.dbf /home/orahome/data/733
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> alter database open;
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: '/home/orahome/data/733/test1.dbf'
SVRMGR> alter database datafile '/home/orahome/data/733/test1.dbf' end backup;
ORA-01235: END BACKUP failed for 1 file(s) and succeeded for 0
ORA-01122: database file 5 failed verification check
ORA-01110: data file 5: '/home/orahome/data/733/test1.dbf'
ORA-01208: data file is an old version - not accessing current version

SVRMGR> recover database
Media recovery complete.
SVRMGR> alter database open;
Statement processed.
SVRMGR> select * from case7;
C1
----------
         7
1 row selected.
SVRMGR> exit


p.457
SVRMGR> select file#, status from v$backup;
FILE#         STATUS
-----         ------
1             ACTIVE
2             NOT ACTIVE
3             NOT ACTIVE
4             NOT ACTIVE
4 rows selected.


p.459-461
c:\orant\bin> svrmgr23
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
With the distributed, replication, parallel query and Spatial Data options
PL/SQL Release 2.3.3.0.0 - Production

SVRMGR> connect internal
Connected.
SVRMGR> startup open
ORACLE instance started.
Database mounted.
Database opened.
Total System Global Area       4480888 bytes
   Fixed Size                    47152 bytes
   Variable Size               4015944 bytes
   Database Buffers             409600 bytes
   Redo Buffers                   8192 bytes

SVRMGR> select name, status, enabled from v$datafile;
NAME                                  STATUS      ENABLED
-----                                 ------      ----------
C:\ORANT\DATABASE\SYS1ORCL.ORA        SYSTEM      READ WRITE
C:\ORANT\DATABASE\USR1ORCL.ORA        ONLINE      READ WRITE
C:\ORANT\DATABASE\RBS1ORCL.ORA        ONLINE      READ WRITE
C:\ORANT\DATABASE\TMP1ORCL.ORA        ONLINE      READ WRITE
C:\ORANT\DATABASE\TST1ORCL.ORA        ONLINE      READ ONLY
5 rows selected.

SVRMGR> create table case8 (c1 number) tablespace user_data;
Statement processed.
SVRMGR> insert into case8 values (8);
1 row processed.
SVRMGR> commit;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> exit
c:\orant\database> copy c*.ora backup
c:\orant\database> svrmgr23
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
With the distributed, replication, parallel query and Spatial Data options
PL/SQL Release 2.3.3.0.0 - Production
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> alter database open;
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: 'c:\orant\database\sys1orcl.ora'
ORA-01207: file is more recent than control file - old control file

SVRMGR> recover database
ORA-00283: Recovery session canceled due to errors
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: ' c:\orant\database\sys1orcl.ora '
ORA-01207: file is more recent than control file - old control file

SVRMGR> recover database using backup controlfile;
ORA-00283: Recovery session canceled due to errors
ORA-01233: file 5 is read only - cannot recover using backup controlfile
ORA-01110: data file 5: 'c:\orant\database\tst1orcl.ora'

SVRMGR> alter database datafile 'c:\orant\database\tst1orcl.ora ' offline;
Statement processed.

SVRMGR> recover database using backup controlfile;
ORA-00279: change 319914 generated at 10/15/97 23:21:08 needed for thread 1
ORA-00289: suggestion : C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000055.ARC
ORA-00280: change 319914 for thread 1 is in sequence #55
 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
Log applied.
Media recovery complete.
SVRMGR> alter database open;
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SVRMGR> alter database open noresetlogs;
ORA-01588: must use RESETLOGS option for database open
SVRMGR> alter database open resetlogs;
Statement processed.

SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            C:\ORANT\database\archive
Oldest online log sequence     1
Next log sequence to archive   1
Current log sequence           1

SVRMGR> select name, status, enabled from v$datafile;
NAME                                  STATUS      ENABLED
-----                                 ------      -----------
C:\ORANT\DATABASE\SYS1ORCL.ORA        SYSTEM      READ WRITE
C:\ORANT\DATABASE\USR1ORCL.ORA        ONLINE      READ WRITE
C:\ORANT\DATABASE\RBS1ORCL.ORA        ONLINE      READ WRITE
C:\ORANT\DATABASE\TMP1ORCL.ORA        ONLINE      READ WRITE
C:\ORANT\DATABASE\TST1ORCL.ORA        OFFLINE     READ ONLY
5 rows selected.
SVRMGR> alter tablespace test online;
Statement processed.
SVRMGR> select * from case8;
c1
--
8
1 rows selected.


p.461
RMAN> run {
2> allocate channel c1 type disk;
3> backup tablespace "test" include current controlfile
4> format 'aatst%s';
5> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=16 devtype=DISK
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel c1: starting datafile backupset
RMAN-08502: set_count=13 set_stamp=316025242
RMAN-08010: channel c1: including datafile 5 in backupset
RMAN-08011: channel c1: including current controlfile in backupset
RMAN-08013: channel c1: piece 1 created
RMAN-08503: piece handle=AATST13 comment=NONE
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-08031: released channel: c1


p.462
SVRMGR> startup
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
ORA-00205: error in identifying controlfile, check alert log for more info


D:> ORANT\DATABASE> rman80 target=\"internal\oracle@prod\" rcvcat=\"rman\rman@rcv\"
Recovery Manager: Release 8.0.3.0.0 - Production
RMAN-06006: connected to target database: oracle (not mounted)
RMAN-06008: connected to recovery catalog database
RMAN> run {
2> allocate channel c1 type disk;
3> restore controlfile to 'c:\orant\database\ctl1orcl.ora';
4> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=13 devtype=DISK
RMAN-03022: compiling command: restore
RMAN-03023: executing command: restore
RMAN-08016: channel c1: starting datafile backupset restore
RMAN-08502: set_count=1 set_stamp=11384480
RMAN-08021: channel c1: restoring controlfile
RMAN-08505: output filename=C:\ORANT\DATABASE\CTL1ORCL.ORA
RMAN-08023: channel c1: restored backup piece 1
RMAN-08511: piece handle=AATST13 params=NULL
RMAN-08024: channel c1: restore complete
RMAN-08031: released channel: c1


p.463
RMAN> register database;
RMAN-03022: compiling command: register
RMAN-03023: executing command: register
RMAN-08006: database registered in recovery catalog
RMAN-03023: executing command: full resync
RMAN-08029: snapshot controlfile name set to default value: %ORACLE_HOME%\DATABASE\SNCF%ORACLE_SID%.ORA
RMAN-08002: starting full resync of recovery catalog
RMAN-08004: full resync complete
RMAN> list incarnation of database;
RMAN-03022: compiling command: list
RMAN-06240: List of Database Incarnations
RMAN-06241: DB Key  Inc Key DB Name  DB ID          CUR Reset SCN  Reset Time
RMAN-06242: ------- ------- -------- -------------- --- ---------- -------
RMAN-06243: 1       2       ORACLE   1189192555     YES 1          01-NOV-97


RMAN> reset database;
RMAN-03022: compiling command: reset
RMAN-03023: executing command: reset
RMAN-08006: database registered in recovery catalog
RMAN-03023: executing command: full resync
RMAN-08002: starting full resync of recovery catalog
RMAN-08004: full resync complete
RMAN> list incarnation of database;
RMAN-03022: compiling command: list
RMAN-06240: List of Database Incarnations
RMAN-06241: DB Key  Inc Key DB Name  DB ID           CUR Reset SCN  Reset Time
RMAN-06242: ------- ------- -------- --------------- --- ---------- -------
RMAN-06243: 1       2       ORACLE   1189192555      NO  1          01-NOV-97
RMAN-06243: 1       982     ORACLE   1189192555      YES 102646     01-NOV-97


p.465
ORA-00376: file 6 cannot be read at this time


p.466-467
SVRMGR> connect internal
Statement processed
SVRMGR> alter database datafile '/mcsc2/orahome/data/PROD/rotest.dbf' offline;
Statement processed.
SVRMGR> select tablespace_name, status from dba_tablespaces;
TABLESPACE_NAME      STATUS
---------------      ------
SYSTEM               ONLINE
RBS                  ONLINE
TEMP                 ONLINE
TOOLS                ONLINE
USERS                ONLINE
ROTEST               ONLINE

SVRMGR> select name, status from v$datafile;
NAME                                        STATUS
----                                        ------
/mcsc2/orahome/data/PROD/system01.dbf       SYSTEM
/mcsc2/orahome/data/PROD/rbs01.dbf          ONLINE
/mcsc2/orahome/data/PROD/temp01.dbf         ONLINE
/mcsc2/orahome/data/PROD/tools01.dbf        ONLINE
/mcsc2/orahome/data/PROD/users01.dbf        ONLINE
/mcsc2/orahome/data/PROD/rotest.dbf         RECOVER
/mcsc2/orahome/data/PROD/rotest2.dbf        ONLINE

SVRMGR> insert into rotab3 select * from scott.dept;
ORA-00376: file 6 cannot be read at this time
ORA-01110: data file 6: '/mcsc2/orahome/data/PROD/rotest.dbf'
SVRMGR> select * from fet$ where ts#= 5;
TS#      FILE#       BLOCK#      LENGTH
---      -----       ------      ------
5        6           17          1008

SVRMGR> alter tablespace rotest add datafile 
'/mcsc2/orahome/data/PROD/rotest3.dbf' size 50k;
Statement processed.
SVRMGR> select * from fet$ where ts#=5;
TS#      FILE#       BLOCK#       LENGTH
---      -----       ------       ------
5        6           17           1008
5        8           2            24

SVRMGR> insert into rotab3 select * from scott.dept
ORA-00376: file 6 cannot be read at this time
ORA-01110: data file 6: '/mcsc2/orahome/data/PROD/rotest.dbf'
SVRMGR> create table rotab4 (c1 number) tablespace rotest;
ORA-00376: file 6 cannot be read at this time
ORA-01110: data file 6: '/mcsc2/orahome/data/PROD/rotest.dbf'

SVRMGR> alter database datafile '/mcsc2/orahome/data/PROD/rotest.dbf' online;
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/mcsc2/orahome/data/PROD/rotest.dbf'
SVRMGR> recover tablespace rotest;
ORA-00283: Recovery session canceled due to errors
ORA-01124: cannot recover data file 7 - file is in use or recovery
ORA-01110: data file 7: '/mcsc2/orahome/data/PROD/rotest2.dbf'
SVRMGR> recover datafile '/mcsc2/orahome/data/PROD/rotest.dbf';
ORA-00279: Change 11852 generated at 09/14/94 12:22:45 needed for thread 1
ORA-00289: Suggestion : /mcsc2/orahome/admin/PROD/arch/arch.log1_13.dbf
ORA-00280: Change 11852 for thread 1 is in sequence #13
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
auto
Applying suggested logfile...
Log applied.
Media recovery complete.
SVRMGR> alter database datafile '/mcsc2/orahome/data/PROD/rotest.dbf' online;
Statement processed.
SVRMGR> insert into rotab3 select * from scott.dept where rownum <2;
1 row processed.


p.468-470
C:\ORANT\DATABASE>svrmgr30
Oracle Server Manager Release 3.0.3.0.0 - Production
(c) Copyright 1997, Oracle Corporation.  All Rights Reserved.
Oracle8 Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
SVRMGR> connect internal
Password:
Connected.
SVRMGR> startup mount
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            C:\ORANT\database\archive
Oldest online log sequence     72
Next log sequence to archive   73
Current log sequence           73
SVRMGR> alter database open;
Statement processed.
SVRMGR> select file#, blocks, ts# from file$;
FILE#      BLOCKS     TS#
---------- ---------- ----------
         1      15360          0
         2       1536          1
         3       5120          2
         4        512          3
4 rows selected.
SVRMGR> alter tablespace user_data add datafile 'c:\orant\database\usr2orcl.ora'
 size 10k;
Statement processed.
SVRMGR> select file#, blocks, ts# from file$;
FILE#      BLOCKS     TS#
---------- ---------- ----------
         1      15360          0
         2       1536          1
         3       5120          2
         4        512          3
         5          5          1
5 rows selected.
SVRMGR> host
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.
C:\ORANT\DATABASE>dir usr*
 Volume in drive C is MS-DOS_6
 Volume Serial Number is 2338-6CE4
 Directory of C:\ORANT\DATABASE
10/19/97  07:29a             3,147,776 USR1ORCL.ORA
10/19/97  05:08p                12,288 USR2ORCL.ORA
               2 File(s)      3,160,064 bytes
                             42,827,776 bytes free
C:\ORANT\DATABASE>exit
SVRMGR> alter database datafile 'c:\orant\database\usr2orcl.ora' resize 1m;
Statement processed.
SVRMGR> select file#, blocks, ts# from file$;
FILE#      BLOCKS     TS#
---------- ---------- ----------
         1      15360          0
         2       1536          1
         3       5120          2
         4        512          3
         5        512          1
5 rows selected.
SVRMGR> host
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.
C:\ORANT\DATABASE>dir usr*
 Volume in drive C is MS-DOS_6
 Volume Serial Number is 2338-6CE4
 Directory of C:\ORANT\DATABASE
10/19/97  07:29a             3,147,776 USR1ORCL.ORA
10/19/97  05:15p             1,050,624 USR2ORCL.ORA
               2 File(s)      4,198,400 bytes
                             41,156,608 bytes free


p.473
cosmos% svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
With the distributed, replication, parallel query and Spatial Data options
PL/SQL Release 2.3.3.0.0 - Production

SVRMGR> connect internal
Connected.
SVRMGR> startup
ORACLE instance started.
Database mounted.
Database opened.
Total System Global Area       4480888 bytes
   Fixed Size                    47152 bytes
   Variable Size                015944 bytes
   Database Buffers             409600 bytes
   Redo Buffers                   8192 bytes
SVRMGR> create table case11 (c1 number) tablespace users;
Statement processed.


p.473-474
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> insert into case11 values (11);
1 row processed.
SVRMGR> commit;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR> startup mount
ORACLE instance started.
Database mounted.

SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/orahome/product/7.3.3/
                               dbs/arch
Oldest online log sequence     61
Next log sequence to archive   63
Current log sequence           63

SVRMGR> recover database until cancel;
Media recovery complete.
SVRMGR> alter database open resetlogs;
Statement processed.
SVRMGR> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/orahome/product/7.3.3/
                               dbs/arch
Oldest online log sequence     0
Next log sequence to archive   1
Current log sequence           1

SVRMGR> insert into case11 values(11);
1 row processed.
SVRMGR> commit;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.


p.474-475
SVRMGR> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR> host
cosmos% rm /home/orahome/data/733/users01.dbf
cosmos% cp /home/orahome/backup/users01.dbf /home/orahome/data/733
cosmos% exit
cosmos% 
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> recover database
ORA-00283: Recovery session canceled due to errors
ORA-01190: control file or data file 4 is from before the last RESETLOGS
ORA-01110: data file 4: '/home/orahome/data/733/users01.dbf'


p.475
SVRMGR> shutdown
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SVRMGR> host
cosmos% cp /home/orahome/backup/control01.ctl /home/orahome/data/733
cosmos% exit
cosmos% 
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> recover database using backup controlfile;
ORA-00283: Recovery session canceled due to errors
ORA-01190: control file or data file 1 is from before the last RESETLOGS
ORA-01110: data file 1: '/home/orahome/data/733/system01.dbf'


p.475-476
SVRMGR> shutdown
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SVRMGR> host
cosmos% cp /home/orahome/backup/*.* /home/orahome/data/733
cosmos% exit
cosmos%

SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/orahome/product/7.3.3/dbs/arch
Oldest online log sequence     59
Next log sequence to archive   61
Current log sequence           61


p.476-477
SVRMGR> recover database using backup controlfile;
ORA-00279: Change 6406 generated at 02/04/95 17:36:35 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_61.dbf
ORA-00280: Change 6406 for thread 1 is in sequence #61
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 6422 generated at 02/07/95 10:34:53 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_62.dbf
ORA-00280: Change 6422 for thread 1 is in sequence #62
ORA-00278: Logfile '/home/orahome/product/7.3.3/dbs/arch1_61.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 6425 generated at 02/07/95 10:35:26 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_63.dbf
ORA-00280: Change 6425 for thread 1 is in sequence #63
ORA-00278: Logfile '/home/orahome/product/7.3.3/dbs/arch1_62.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
/home/orahome/product/7.3.3/dbs/arch1_1.dbf
Applying logfile...
ORA-00310: archived log contains sequence 1; sequence 63 required
ORA-00334: archived log: '/home/orahome/product/7.3.3/dbs/arch1_1.dbf'
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
cancel
Media recovery canceled.


p.477
SVRMGR> alter database open resetlogs;
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/home/orahome/data/733/system01.dbf'


SVRMGR> recover database using backup controlfile until cancel;
ORA-00279: Change 6425 generated at 02/07/95 10:35:26 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_63.dbf
ORA-00280: Change 6425 for thread 1 is in sequence #63
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
cancel
Media recovery cancelled.
SVRMGR> alter database open resetlogs;
Statement processed.


p.478
SVRMGR> select * from case11;
C1
--
11
1 row selected.


p.483-484
cosmos% svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
With the distributed, replication, parallel query and Spatial Data options
PL/SQL Release 2.3.3.0.0 - Production

SVRMGR> connect internal
Connected.
SVRMGR> startup open
ORACLE instance started.
Database mounted.
Database opened.
Total System Global Area       4480888 bytes
   Fixed Size            47152 bytes
   Variable Size       4015944 bytes
   Database Buffers      09600 bytes
   Redo Buffers           8192 bytes

SVRMGR> alter tablespace users add datafile 
'/home/orahome/data/733/users02.dbf' size 40k;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> shutdown abort
 ORACLE instance shut down.

SVRMGR> host
cosmos% rm /home/orahome/data/733/users02.dbf
cosmos% exit

SVRMGR> startup
ORACLE instance started.
Total System Global Area      12071016 bytes
Fixed Size                       46136 bytes
Variable Size                 11090992 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
ORA-01157: cannot identify data file 5 - file not found
ORA-01110: data file 5: '/home/orahome/data/733/users02.dbf'
SVRMGR> alter database create datafile 
'/home/orahome/data/733/users02.dbf';
Statement processed.
SVRMGR> recover datafile '/home/orahome/data/733/users02.dbf'
ORA-00279: Change 6420 generated at 02/07/95 11:00:51 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_62.dbf
ORA-00280: Change 6420 for thread 1 is in sequence #62
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
<enter>
Applying suggested logfile...
Log applied.
Media recovery complete.
SVRMGR> alter database open;
Statement processed.
SVRMGR> host
cosmos% ls -l /home/orahome/data/733/users02.dbf
-rw-r-----   1 oracle7  dba        43008 Feb  7 13:09 /home/orahome/data/733/users02.dbf


p.485
recover database until time 'yyyy-mm-dd:01:58:00';


p.487
cosmos% svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
With the distributed, replication, parallel query and Spatial Data options
PL/SQL Release 2.3.3.0.0 - Production

SVRMGR> connect internal
Connected
SVRMGR> select a, to_char(b, 'hh24:mi:ss') time from timer;
A        TIME
--       ----
1        17:48:59
2        17:50:36
3        17:51:07
4        17:52:00
5        17:53:05
6        17:54:45
7        17:56:37
7 rows selected.


p.487-488
SVRMGR> connect internal
Connected.
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> recover database until time '1994-09-15:17:55:00';
Media recovery complete.
SVRMGR> alter database open resetlogs;
Statement processed.
SVRMGR> select a, to_char(b, 'hh24:mi:ss') time from timer;
A        TIME
--       ----
1        17:48:59
2        17:50:36
3        17:51:07
4        17:52:00
5        17:53:05
6        17:54:45
6 rows selected.


p.488-490
SQL> select a, to_char(b, 'HH24:MI:SS') time, c from timer;
A      TIME               C
--     --------           ----------
1      15:49:02           Switched Logs
2      15:51:51           Insert
3      15:55:38           Insert
4      15:57:29           Switched Logs
5      16:00:31           Insert
6      16:02:03           Insert
7      16:04:44           Switched Logs
8      15:04:34           Time Switch
9      15:07:27           Insert
10     15:09:35           Switched Logs
11     16:05:38           Time Change
12     15:05:25           Time Change
13     15:08:14           Switched Logs
13 rows selected.
SVRMGR> connect internal
Connected.
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> archive log list;
Database log mode              ARCHIVELOG
Automatic archival             ENABLED
Archive destination            /mcsc2/orahome/admin/PROD/arch/arch.log
Oldest online log sequence     7
Next log sequence to archive   9
Current log sequence           9

SVRMGR> recover database until time '1994-09-16:16:05:00';
ORA-00279: Change 13388 generated at 09/16/94 14:26:25 needed for thread 1
ORA-00289: Suggestion : /mcsc2/orahome/admin/PROD/arch/arch.log1_3.dbf
ORA-00280: Change 13388 for thread 1 is in sequence #3
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 13427 generated at 09/16/94 15:46:33 needed for thread 1
ORA-00289: Suggestion : /mcsc2/orahome/admin/PROD/arch/arch.log1_4.dbf
ORA-00280: Change 13427 for thread 1 is in sequence #4
ORA-00278: Logfile '/mcsc2/orahome/admin/PROD/arch/arch.log1_3.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 13446 generated at 09/16/94 15:48:55 needed for thread 1
ORA-00289: Suggestion : /mcsc2/orahome/admin/PROD/arch/arch.log1_5.dbf
ORA-00280: Change 13446 for thread 1 is in sequence #5
ORA-00278: Logfile '/mcsc2/orahome/admin/PROD/arch/arch.log1_4.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 13451 generated at 09/16/94 15:57:13 needed for thread 1
ORA-00289: Suggestion : /mcsc2/orahome/admin/PROD/arch/arch.log1_6.dbf
ORA-00280: Change 13451 for thread 1 is in sequence #6
ORA-00278: Logfile '/mcsc2/orahome/admin/PROD/arch/arch.log1_5.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
Media recovery complete.

SVRMGR> alter database open;
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SVRMGR> alter database open resetlogs;
Statement processed.

SQL> select a, to_char(b, 'HH24:MI:SS') time, c from timer;
A      TIME                    C
--     --------                ----------
1      15:49:02                Switched Logs
2      15:51:51                Insert
3      15:55:38                Insert
4      15:57:29                Switched Logs
5      16:00:31                Insert
6      16:02:03                Insert
7      16:04:44                Switched Logs
8      15:04:34                Time Switch
9      15:07:27                Insert
10     15:09:35                Switched Logs
10 rows selected.


p.493-494
cosmos% svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
With the distributed, replication, parallel query and Spatial Data options
PL/SQL Release 2.3.3.0.0 - Production

SVRMGR> connect internal
Connected.
SVRMGR> startup open
ORACLE instance started.
Database mounted.
Database opened.
Total System Global Area       4480888 bytes
   Fixed Size                    47152 bytes
   Variable Size                 15944 bytes
   Database Buffers             409600 bytes
   Redo Buffers                   8192 bytes

SVRMGR> archive log list
Database log mode                Archive Mode
Automatic archival               Enabled
Archive destination            /home/orahome/product/7.3.3/dbs/arch
Oldest online log sequence     60
Next log sequence to archive   62
Current log sequence           62

SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter tablespace USERS offline;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> archive log list
Database log mode                Archive Mode
Automatic archival               Enabled
Archive destination            /home/orahome/product/7.3.3/
                                 dbs/arch
Oldest online log sequence     63
Next log sequence to archive   65
Current log sequence           65
SVRMGR> shutdown abort
ORACLE instance shut down.

SVRMGR> host
cosmos% rm /home/orahome/data/733/*.dbf
cosmos% cp /home/orahome/backup/*.dbf /home/orahome/data/733
cosmos% exit


p.494
SVRMGR> startup mount
ORACLE instance started.
Database mounted.

SVRMGR> recover database
ORA-00279: Change 6420 generated at 02/07/95 11:00:51 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_62.dbf
ORA-00280: Change 6420 for thread 1 is in sequence #62
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
Media recovery complete.

SVRMGR> alter database open;
Statement processed.
SVRMGR> alter tablespace users online;
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '/home/orahome/data/733/users01.dbf'
SVRMGR> recover tablespace users;
ORA-00279: Change 6420 generated at 02/07/95 11:00:51 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_62.dbf
ORA-00280: Change 6420 for thread 1 is in sequence #62
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
auto
Applying suggested logfile...
Log applied.
Media recovery complete.
SVRMGR> alter tablespace users online;
Statement processed.


p.495-496
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> select * from v$datafile;

SVRMGR> select name,  status,  enabled from v$datafile;
NAME                                  STATUS      ENABLED
--------------------------------      ------      -------
/home/orahome/data/733/system01.dbf   SYSTEM      READ WRITE
/home/orahome/data/733/rbs01.dbf      ONLINE      READ WRITE
/home/orahome/data/733/tools01.dbf    ONLINE      READ WRITE
/home/orahome/data/733/users01.dbf    OFFLINE     DISABLED
/home/orahome/data/733/test1.dbf      ONLINE      READ WRITE
/home/orahome/data/733/temp.dbf       ONLINE      READ WRITE
6 rows selected.

SVRMGR> alter database datafile '/home/orahome/data/733/users01.dbf' online;
Statement processed.
SVRMGR> recover database
ORA-00279: Change 6420 generated at 02/07/95 11:00:51 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_62.dbf
ORA-00280: Change 6420 for thread 1 is in sequence #62
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
auto
Applying suggested logfile...
Log applied.
Media recovery complete.

SVRMGR> select name, status, enabled from v$datafile;
NAME                                    STATUS         ENABLED
---------------------------------       ------         -------
/home/orahome/data/733/system01.dbf     SYSTEM         READ WRITE
/home/orahome/data/733/rbs01.dbf        ONLINE         READ WRITE
/home/orahome/data/733/tools01.dbf      ONLINE         READ WRITE
/home/orahome/data/733/users01.dbf      ONLINE         DISABLED
/home/orahome/data/733/test1.dbf        ONLINE         READ WRITE
/home/orahome/data/733/temp.dbf         ONLINE         READ WRITE
6 rows selected.

SVRMGR> alter database open;
Statement processed.
SVRMGR> select tablespace_name, status from dba_tablespaces;
TABLESPACE_NAME      STATUS
---------------      ------
SYSTEM               ONLINE
RBS                  ONLINE
TOOLS                ONLINE
USERS                OFFLINE
TEST                 ONLINE
TEMP                 ONLINE
6 rows selected.

SVRMGR> create table case14 (c1 number) tablespace users;
ORA-01542: tablespace 'USERS' is offline, cannot allocate space in it
SVRMGR> alter tablespace users online;
Statement processed.
SVRMGR> create table case14 (c1 number) tablespace users;
Statement processed.
SVRMGR> exit
SQL*DBA complete.


p.498-499
SVRMGR> startup
ORACLE instance started.
Database mounted.
Database opened.
Total System Global Area       4480888 bytes
              Fixed Size         47152 bytes
           Variable Size       4015944 bytes
        Database Buffers        409600 bytes
            Redo Buffers          8192 bytes

SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ ONLY
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.

SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.

SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host
cosmos% rm /home/orahome/data/733/*.dbf
cosmos% cp /home/orahome/backup/*.dbf /home/orahome/data/733
cosmos% exit
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> recover database
ORA-00279: Change 6420 generated at 02/07/95 11:00:51 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_62.dbf
ORA-00280: Change 6420 for thread 1 is in sequence #62
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
Media recovery complete.
SVRMGR> alter database open;
Statement processed.
SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ ONLY
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.


p.499-500
SVRMGR> startup
ORACLE instance started.
Database mounted.
Database opened.
Total System Global Area       4480888 bytes
              Fixed Size         47152 bytes
           Variable Size       4015944 bytes
        Database Buffers        409600 bytes
            Redo Buffers          8192 bytes

SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ WRITE
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.

SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter tablespace USERS read only;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.

SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host
cosmos% rm /home/orahome/data/733/*.dbf
cosmos% cp /home/orahome/backup/*.dbf /home/orahome/data/733
cosmos% exit
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> recover database
ORA-00279: Change 6507 generated at 02/12/95 18:33:31 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_70.dbf
ORA-00280: Change 6507 for thread 1 is in sequence #70
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
Media recovery complete.
SVRMGR> alter database open;
Statement processed.
SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ ONLY
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.


p.501-502
SVRMGR> startup
ORACLE instance started.
Database mounted.
Database opened.
Total System Global Area       4480888 bytes
              Fixed Size         47152 bytes
           Variable Size       4015944 bytes
        Database Buffers        409600 bytes
            Redo Buffers          8192 bytes

SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ ONLY
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.

SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter tablespace USERS read write;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.

SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host
cosmos% rm /home/orahome/data/733/*.dbf
cosmos% cp /home/orahome/backup/*.dbf /home/orahome/data/733
cosmos% exit
SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> recover database
ORA-00279: Change 6551 generated at 02/12/95 18:39:37 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_72.dbf
ORA-00280: Change 6551 for thread 1 is in sequence #72
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
Media recovery complete.
SVRMGR> alter database open;
Statement processed.
SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ WRITE
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.


p.502-503
SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ ONLY
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.

SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host
cosmos% rm /home/orahome/data/733/*.dbf
cosmos% rm /home/orahome/data/733/*.ctl
cosmos% cp /home/orahome/backup/*.dbf /home/orahome/data/733
cosmos% cp /home/orahome/backup/*.ctl /home/orahome/data/733
cosmos% exit
SVRMGR> startup mount
ORACLE instance started.
Database mounted.

SVRMGR> recover database using backup controlfile;
ORA-00283: Recovery session canceled due to errors
ORA-01233: file 4 is read only - cannot recover using backup controlfile
ORA-01110: data file 4: '/home/orahome/data/733/users01.dbf'

SVRMGR> alter database datafile '/home/orahome/data/733/users01.dbf' offline;
Statement processed.
SVRMGR> recover database using backup controlfile;
ORA-00279: Change 6522 generated at 02/12/95 18:34:54 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_70.dbf
ORA-00280: Change 6522 for thread 1 is in sequence #70
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 6539 generated at 02/13/95 16:19:08 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_71.dbf
ORA-00280: Change 6539 for thread 1 is in sequence #71
ORA-00278: Logfile '/home/orahome/product/7.3.3/dbs/arch1_70.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 6542 generated at 02/13/95 16:19:38 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_72.dbf
ORA-00280: Change 6542 for thread 1 is in sequence #72
ORA-00278: Logfile '/home/orahome/product/7.3.3/dbs/arch1_71.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
/home/orahome/data/733/redo03.log
Applying logfile...
Log applied.
Media recovery complete.

SVRMGR> alter database open resetlogs;
Statement processed.
SVRMGR> alter tablespace users online;
Statement processed.
SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ ONLY
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.


p.504-506
SVRMGR> archive log list
Database log mode              ARCHIVELOG
Automatic archival             ENABLED
Archive destination            /home/orahome/product/7.3.3/
                               dbs/arch
Oldest online log sequence     69
Next log sequence to archive   71
Current log sequence           71

SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ WRITE
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.

SVRMGR> create table test_5 (c1 number) tablespace users;
Statement processed.
SVRMGR> insert into test_5 values(5);
1 row processed.
SVRMGR> commit;
Statement processed.

SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter tablespace USERS read only;
Statement processed.
SVRMGR> archive log list
Database log mode              ARCHIVELOG
Automatic archival             ENABLED
Archive destination            /home/orahome/product/7.3.3/
                               dbs/arch
Oldest online log sequence     70
Next log sequence to archive   72
Current log sequence           72

SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host
cosmos% rm /home/orahome/data/733/*.dbf
cosmos% rm /home/orahome/data/733/*.ctl
cosmos% cp /home/orahome/backup/*.dbf /home/orahome/data/733
cosmos% cp /home/orahome/backup/*.ctl /home/orahome/data/733
cosmos% exit

SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> recover database using backup controlfile;
ORA-00279: Change 6539 generated at 02/13/95 17:02:34 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_71.dbf
ORA-00280: Change 6539 for thread 1 is in sequence #71
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 6562 generated at 02/13/95 17:05:37 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_72.dbf
ORA-00280: Change 6562 for thread 1 is in sequence #72
ORA-00278: Logfile '/home/orahome/product/7.3.3/dbs/arch1_71.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 6566 generated at 02/13/95 17:07:27 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_73.dbf
ORA-00280: Change 6566 for thread 1 is in sequence #73
ORA-00278: Logfile '/home/orahome/product/7.3.3/dbs/arch1_72.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
/home/orahome/data/733/redo01.log
Applying logfile...
Log applied.
Media recovery complete.

SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ WRITE
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.

SVRMGR> alter database open resetlogs;
Statement processed.
SVRMGR> select * from test_5;
C1
--
5
1 row selected.
SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ ONLY
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.


p.506-508
SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/orahome/product/7.3.3/
                               dbs/arch
Oldest online log sequence     68
Next log sequence to archive   70
Current log sequence           70
SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ ONLY
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> alter tablespace users read write;
Statement processed.
SVRMGR> alter database backup controlfile to 
'/home/orahome/backup/rw_control.ctl';
Statement processed.

SVRMGR> create table test_6 (c1 number);
Statement processed.
SVRMGR> insert into test_6 values (6);
1 row processed.
SVRMGR> commit;
Statement processed.
SVRMGR> alter system switch logfile;
Statement processed.
SVRMGR> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/orahome/product/7.3.3/
                               dbs/arch
Oldest online log sequence     70
Next log sequence to archive   72
Current log sequence           72

SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host
cosmos% rm /home/orahome/data/733/*.dbf
cosmos% rm /home/orahome/data/733/*.ctl
cosmos% cp /home/orahome/backup/*.dbf /home/orahome/data/733
cosmos% cp /home/orahome/backup/rw_control.ctl 
/home/orahome/data/733/control01.ctl
cosmos% exit

SVRMGR> startup mount
ORACLE instance started.
Database mounted.
SVRMGR> recover database using backup controlfile;
ORA-00279: Change 6507 generated at 02/12/95 18:33:31 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_70.dbf
ORA-00280: Change 6507 for thread 1 is in sequence #70
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 6532 generated at 02/13/95 16:48:01 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_71.dbf
ORA-00280: Change 6532 for thread 1 is in sequence #71
ORA-00278: Logfile '/home/orahome/product/7.3.3/dbs/arch1_70.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}

Applying suggested logfile...
Log applied.
ORA-00279: Change 6545 generated at 02/13/95 16:50:06 needed for thread 1
ORA-00289: Suggestion : /home/orahome/product/7.3.3/dbs/arch1_72.dbf
ORA-00280: Change 6545 for thread 1 is in sequence #72
ORA-00278: Logfile '/home/orahome/product/7.3.3/dbs/arch1_71.dbf' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource | CANCEL}
/home/orahome/data/733/redo03.log
Applying logfile...
Log applied.
Media recovery complete.

SVRMGR> select name, enabled from v$datafile;
NAME                                  ENABLED
--------------------------------      -------
/home/orahome/data/733/system01.dbf   READ WRITE
/home/orahome/data/733/rbs01.dbf      READ WRITE
/home/orahome/data/733/tools01.dbf    READ WRITE
/home/orahome/data/733/users01.dbf    READ WRITE
/home/orahome/data/733/test1.dbf      READ WRITE
/home/orahome/data/733/temp.dbf       READ WRITE
6 rows selected.
SVRMGR> alter database open resetlogs;
Statement processed.
SVRMGR> select * from test_6;
C1
--
6
1 row selected.


p.510
alter database open;
*
ORA-01666: controlfile is for a standby database


p.511
alter database mount standby database;
*
ORA-01665: controlfile is not a standby controlfile


alter database mount standby database;
*
ORA-00205: error in identifying control file 
'/ds1/oracle/7.3.1/dbs/ctl1stby.ctl'
ORA-07360: sfifi: stat error, unable to obtain information about file.
SEQUENT DYNIX/ptx Error: 2: No such file or directory


p.511-512
ORA-00279: Change 7799 generated at 09/13/95 16:46:06 needed for thread 1
ORA-00289: Suggestion : /ds1/oracle/7.3.1/dbs/arch/arch1_42.dbf
ORA-00280: Change 7799 for thread 1 is in sequence #42
ORA-00308: cannot open archived log /ds1/arch/arch1_42.dbf
ORA-07366: sfifi: invalid file, file does not have valid header block


p.512
ORA-00279: Change 7176 generated at 09/13/95 16:46:06 needed for thread 1
ORA-00289: Suggestion : /ds1/oracle/7.3.1./dbs/arch/arch1_41.dbf
ORA-00280: Change 7176 for thread 1 is in sequence #41
Specify log: {<RET>=suggested \ filename | AUTO | CANCEL}

ORA-00308: cannot open archived log /ds1/arch/arch_41.dbf
ORA-07360: sfifi: stat error, unable to obtain information about file
SEQUENT DYNIX/ptx Error: 2: No such file or directory


p.513
ORA-00279: Change 8087 generated at 09/13/95 16:46:06 needed for thread 1
ORA-00289: Suggestion : /ds1/oracle/7.3.1./dbs/arch/arch1_57.dbf
ORA-00280: Change 8087 for thread 1 is in sequence #57
Specify log: {<RET>=suggested \ filename | AUTO | CANCEL}
/ds1/logs/log2st73.dbf
ORA-00310: archived log contains sequence 56; sequence 57 required
ORA-00334: archived log: '/ds1/logs/log2st73.dbf'


ORA-00279: Change 7799 generated at 09/13/95 16:46:06 needed for thread 1
ORA-00289: Suggestion : /ds1/oracle/7.3.1/dbs/arch/arch1_42.dbf
ORA-00280: Change 7799 for thread 1 is in sequence #42
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00283: Recovery session canceled due to errors
ORA-00333: redo log read error block 2 count 256


ORA-00279: change 22130 generated at 09/13/95 06:46:01 needed for thread 1
ORA-00289: Suggestion : /ds1/oracle/7.3.1/arch/arch1_71.dbf
ORA-00280: Change 22130 for thread 1 is in sequence #71
Specify log: {<RET>=suggested | filename | AUTO | FROM logsource| CANCEL
...
ORA-00283: Recovery session canceled due to errors
ORA-01670: new datafile 8 needed for standby database recovery


p.514
SELECT NAME FROM V$DATAFILE WHERE FILE# = filenumber;


p.515-516
SVRMGR> create table case17 (c1 number)
     2> partition by range(c1)
     3> (partition p1 values less than (10) tablespace user_data,
     4> partition p2 values less than (20) tablespace test);
Statement processed.
SVRMGR> select partition_name, high_value, tablespace_name
     2> from user_tab_partitions where table_name='CASE17';
PARTITION_NAME                 HIGH_VALUE             TABLESPACE_NAME
------------------------------ --------------         ---------------
P1                             1                      USER_DATA
P2                             20                     TEST
2 rows selected.
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> host del c:\orant\database\tst1orcl.ora
SVRMGR> startup mount
ORACLE instance started.
Total System Global Area      12071008 bytes
Fixed Size                       46136 bytes
Variable Size                 11090984 bytes
Database Buffers                409600 bytes
Redo Buffers                    524288 bytes
Database mounted.
SVRMGR> alter database datafile 'c:\orant\database\tst1orcl.ora' offline;
Statement processed.
SVRMGR> alter database open;
Statement processed.
SVRMGR> select * from case17;
C1
----------
ORA-00376: file 4 cannot be read at this time
ORA-01110: data file 4: 'C:\ORANT\DATABASE\TST1ORCL.ORA'
SVRMGR> select * from case17 partition (p1);
C1
----------
0 rows selected.
SVRMGR> insert into case17 partition(p1) values (1);
1 row processed.
SVRMGR> commit;
Statement processed.
SVRMGR> insert into case17 partition(p2) values (15);
ORA-00376: file 4 cannot be read at this time
ORA-01110: data file 4: 'C:\ORANT\DATABASE\TST1ORCL.ORA'


p.516-517
C:\ORANT\DATABASE>rman80 target=\"internal/oracle@prod\" rcvcat=\"rman/aa@rcv\"
Recovery Manager: Release 8.0.3.0.0 - Production
RMAN-06005: connected to target database: ORACLE
RMAN-06008: connected to recovery catalog database
RMAN> run{
2> allocate channel c1 type disk;
3> restore datafile 'c:\orant\database\tst1orcl.ora';
4> recover tablespace "test";
5> sql 'alter tablespace test online';
6> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: c1
RMAN-08500: channel c1: sid=17 devtype=DISK
RMAN-03022: compiling command: restore
RMAN-03025: performing implicit partial resync of recovery catalog
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03023: executing command: restore
RMAN-08016: channel c1: starting datafile backupset restore
RMAN-08502: set_count=5 set_stamp=316242849
RMAN-08019: channel c1: restoring datafile 4
RMAN-08509: destination for restore of datafile 4: C:\ORANT\DATABASE\TST1ORCL.ORA
RMAN-08023: channel c1: restored backup piece 1
RMAN-08511: piece handle=AATST316242849.5 params=NULL
RMAN-08024: channel c1: restore complete
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: recover
RMAN-03022: compiling command: recover(1)
RMAN-03022: compiling command: recover(2)
RMAN-03022: compiling command: recover(3)
RMAN-03023: executing command: recover(3)
RMAN-08054: starting media recovery
RMAN-08515: archivelog filename=C:\ORANT\DATABASE\ARCHIVE\ORCLT0001S0000000611.ARC thread=1 sequence=611
RMAN-08055: media recovery complete
RMAN-03022: compiling command: recover(4)
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-03022: compiling command: sql
RMAN-06162: sql statement: alter tablespace test online
RMAN-03023: executing command: sql
RMAN-08031: released channel: c1


p.517
SVRMGR> insert into case17 partition (p2) values (15);
1 row processed.
SVRMGR> select * from case17 partition (p2);
C1
----------
        15
1 row selected.


p.518-520
SVRMGR>
SVRMGR> select to_char(sysdate,'YY-MON-DD:HH24:MI:SS') from dual;

TO_CHAR(SYSDATE,'Y
--------------------------------
97-JUL-05:15:50:49

SVRMGR>
SVRMGR> select table_name,tablespace_name from sys.user_tables;

TABLE_NAME                     TABLESPACE_NAME 
------------------------------ -------------------
DEPT                           WEEK1
EMP                            WEEK1

SVRMGR> connect internal
Connected.
SVRMGR> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u03/app/oracle/product/8.0.3/
                               dbs/arch
Oldest online log sequence     2
Next log sequence to archive   4
Current log sequence           4
SVRMGR> 
SVRMGR> 
SVRMGR> select to_char(sysdate,'YY-MON-DD:HH24:MI:SS') from dual;
TO_CHAR(SYSDATE,'Y
-------------------------------
97-JUL-05:15:53:21
1 row selected.
SVRMGR> alter database backup controlfile to 
'/home/usupport/gsinghal/clone/backup01.ctl';
Statement processed.
SVRMGR> connect gs/gs
Connected.
SVRMGR> select * from dept;
DEPTNO     DNAME                          LOC
---------- ------------------------------ -----------
       10  ACCOUNTING                     NEW YORK
       20  RESEARCH                       DALLAS
       30  SALES                          CHICAGO
       40  OPERATIONS                     BOSTON
4 rows selected.

SVRMGR> select * from emp;
EMPNO ENAME   JOB        MGR  HIREDATE   SAL   COMM  DEPTNO
----- ------  ---------- ---- ---------- ----- ----- ------
7369  SMITH   CLERK      7902 17-DEC-80  800         20
7499  ALLEN   SALESMAN   7698 20-FEB-81  1600  300   30
7521  WARD    SALESMAN   7698 22-FEB-81  1250  500   30
7566  JONES   MANAGER    7839 02-APR-81  2975        20
7654  MARTIN  SALESMAN   7698 28-SEP-81  1250  1400  30
7698  BLAKE   MANAGER    7839 01-MAY-81  2850        30
7782  CLARK   MANAGER    7839 09-JUN-81  2450        10
7788  SCOTT   ANALYST    7566 09-DEC-82  3000        20
7839  KING    PRESIDENT       17-NOV-81  5000        10
7844  TURNER  SALESMAN   7698 08-SEP-81  1500  0     30
7876  ADAMS   CLERK      7788 12-JAN-83  100         20
7900  JAMES   CLERK      7698 03-DEC-81  950         30
7902  FORD    ANALYST    7566 03-DEC-81  3000        20
7934  MILLER  CLERK      7782 23-JAN-82  1300        10
14 rows selected.
SVRMGR> connect internal
Connected.
SVRMGR> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR> exit


p.520-521
SVRMGR> connect internal
Connected.
SVRMGR> startup
ORACLE instance started.
Total System Global Area                 5131060 bytes
Fixed Size                                 44924 bytes
Variable Size                            4152248 bytes
Database Buffers                          409600 bytes
Redo Buffers                              524288 bytes
Database mounted.
Database opened.
SVRMGR> connect gs/gs;
Connected.
SVRMGR> 
SVRMGR> alter table dept modify (dname varchar2(30));
Statement processed.
SVRMGR> insert into dept values (50,'ADVANCED ANALYSIS','CA');
1 row processed.
SVRMGR> insert into dept values (60,'PIC','CA');
1 row processed.
SVRMGR> insert into dept values (70,'ESCALATIONS CENTER','CA');
1 row processed.
SVRMGR> insert into dept values (50,'SERVER TECHNOLOGY','CA');
1 row processed.
SVRMGR> commit;
Statement processed.
SVRMGR> select * from dept;
DEPTNO     DNAME                          LOC         
---------- ------------------------------ -----------
       10  ACCOUNTING                     NEW YORK     
       20  RESEARCH                       DALLAS       
       30  SALES                          CHICAGO      
       40  OPERATIONS                     BOSTON       
       50  ADVANCED ANALYSIS              CA           
       60  PIC                            CA           
       70  ESCALATIONS CENTER             CA           
       50  SERVER TECHNOLOGY              CA           
8 rows selected.
SVRMGR> 
SVRMGR> 
SVRMGR> select to_char(sysdate,'YY-MON-DD:HH24:MI:SS') from dual;
TO_CHAR(SYSDATE,'Y
-------------------------------
97-JUL-05:16:07:28
1 row selected.
SVRMGR> drop table emp;
Statement processed.
SVRMGR>
SVRMGR>
SVRMGR> create table salgrade tablespace week1 as select * from scott.salgrade;
Statement processed.
SVRMGR>


p.521
SVRMGR> select owner, name, tablespace_name,
     2> to_char(creation_time, 'YYYY-MM-DD:HH24:MI:SS')
     3> from sys.ts_pitr_objects_to_be_dropped
     4> where tablespace_name in ('WEEK1')
     5> and
     6> creation_time > to_date('97-JULY-05:16:07:28','YY-MON-DD:HH24:MI:SS')
     7> order by tablespace_name, creation_time;
OWNER       NAME             TABLESPACE_NAME        TO_CHAR(CREATION_TI
----------- ---------------- ---------------------- -------------------
GS          SALGRADE         WEEK1                  1997-07-05:16:09:21
1 row selected.
SVRMGR>
SVRMGR> alter tablespace week1 offline immediate;
Statement processed.


p.522
SVRMGR> select * from v$log;
GROUP#   THREAD#  SEQUENCE#  BYTES   MEMBERS  ARC  STATUS     FIRST_CHAN  FIRST_TIM
------   ------   ---------  -----   -------  ---  ------     ----------  ---------
1        1         4         512000  1        NO   CURRENT    125997      05-JUL-97
2        1         2         512000  1        YES  INACTIVE   125870      05-JUL-97
3        1         3         512000  1        YES  INACTIVE   125987      05-JUL-97
3 rows selected.
SVRMGR> alter system archive log current;
Statement processed.


SVRMGR> select * from v$log;
GROUP#   THREAD#  SEQUENCE#  BYTES   MEMBERS  ARC  STATUS     FIRST_CHAN  FIRST_TIM
------   -------  ---------  -----   -------  ---  ------     ----------  ---------
1        1        4          512000  1        YES  INACTIVE   125997      05-JUL-97
2        1        5          512000  1        NO   CURRENT    126170      05-JUL-97
3        1        3          512000  1        YES  INACTIVE   125987      05-JUL-97
3 rows selected.
SVRMGR> select * from v$logfile;
GROUP#     STATUS  MEMBER
---------- ------- --------------------------------
1                  /u03/oradata/V803/redoV80301.log
2                  /u03/oradata/V803/redoV80302.log
3                  /u03/oradata/V803/redoV80303.log
3 rows selected.


p.522-523
%setenv ORACLE_SID CLONE
%cp initV803.ora initCLONE.ora

%cp configV803.ora configCLONE.ora

SVRMGR> connect internal
Connected.
SVRMGR> startup nomount 
pfile=/home/usupport/gsinghal/clone/initCLONE.ora
ORACLE instance started.
Total System Global Area               5131060 bytes
Fixed Size                               44924 bytes
Variable Size                          4152248 bytes
Database Buffers                        409600 bytes
Redo Buffers                            524288 bytes

SVRMGR> alter database mount CLONE database;
alter database mount CLONE database
*
ORA-01696: controlfile is not a clone controlfile
SVRMGR> shutdown abort;
ORACLE instance shut down.


p.523-526
SVRMGR> connect internal
Connected.
SVRMGR> startup nomount pfile=/home/usupport/gsinghal/clone/initCLONE.ora
ORACLE instance started.
Total System Global Area               5131060 bytes
Fixed Size                               44924 bytes
Variable Size                          4152248 bytes
Database Buffers                        409600 bytes
Redo Buffers                             524288 bytes
SVRMGR> alter database mount CLONE database;
Statement processed.

SVRMGR> select name,status from v$datafile;
NAME                                                      STATUS 
---------------------------------------------             -------
/home/usupport/gsinghal/clone/system01.dbf                SYSOFF  
/home/usupport/gsinghal/clone/rbs01.dbf                   OFFLINE
/home/usupport/gsinghal/clone/temp01.dbf                  OFFLINE
/home/usupport/gsinghal/clone/tools01.dbf                 OFFLINE
/home/usupport/gsinghal/clone/users01.dbf                 OFFLINE
/home/usupport/gsinghal/clone/obj.dbf                     OFFLINE
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf   OFFLINE
7 rows selected.
SVRMGR> alter database rename file 
'/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf' to 
'/home/usupport/gsinghal/clone/week1.dbf';
Statement processed.

SVRMGR> alter database datafile 
'/home/usupport/gsinghal/clone/system01.dbf' online;
Statement processed.
SVRMGR> alter database datafile '/home/usupport/gsinghal/clone/rbs01.dbf' online;
Statement processed.
SVRMGR> alter database datafile '/home/usupport/gsinghal/clone/temp01.dbf' online;
Statement processed.
SVRMGR> alter database datafile '/home/usupport/gsinghal/clone/week1.dbf' online;
Statement processed.
SVRMGR> select name,status from v$datafile;
NAME                                                     STATUS 
-------------------------------------------------------- -------
/home/usupport/gsinghal/clone/system01.dbf               SYSTEM 
/home/usupport/gsinghal/clone/rbs01.dbf                  ONLINE 
/home/usupport/gsinghal/clone/temp01.dbf                 ONLINE 
/home/usupport/gsinghal/clone/tools01.dbf                OFFLINE
/home/usupport/gsinghal/clone/users01.dbf                OFFLINE
/home/usupport/gsinghal/clone/obj.dbf                    OFFLINE
/home/usupport/gsinghal/clone/week1.dbf                  ONLINE 
7 rows selected.

SVRMGR> recover database using backup controlfile until time '1997-07-05:16:07:28';
ORA-00279: change 126084 generated at 07/05/97 13:44:33 needed for thread 1
ORA-00289: suggestion : /u03/app/oracle/product/8.0.3/dbs/arch1_4.dbf
ORA-00280: change 126084 for thread 1 is in sequence #4
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
Log applied.
Media recovery complete.
SVRMGR> alter database open resetlogs;
Statement processed.
SVRMGR> connect gs/gs
Connected.
SVRMGR> select * from emp;
EMPNO ENAME   JOB        MGR  HIREDATE   SAL   COMM  DEPTNO
----- ------  ---------- ---- ---------- ----- ----- ------
7369  SMITH   CLERK      7902 17-DEC-80  800         20
7499  ALLEN   SALESMAN   7698 20-FEB-81  1600  300   30
7521  WARD    SALESMAN   7698 22-FEB-81  1250  500   30
7566  JONES   MANAGER    7839 02-APR-81  2975        20
7654  MARTIN  SALESMAN   7698 28-SEP-81  1250  1400  30
7698  BLAKE   MANAGER    7839 01-MAY-81  2850        30
7782  CLARK   MANAGER    7839 09-JUN-81  2450        10
7788  SCOTT   ANALYST    7566 09-DEC-82  3000        20
7839  KING    PRESIDENT       17-NOV-81  5000        10
7844  TURNER  SALESMAN   7698 08-SEP-81  1500  0     30
7876  ADAMS   CLERK      7788 12-JAN-83  100         20
7900  JAMES   CLERK      7698 03-DEC-81  950         30
7902  FORD    ANALYST    7566 03-DEC-81  3000        20
7934  MILLER  CLERK      7782 23-JAN-82  1300        10
14 rows selected.

SVRMGR> select * from dept;
DEPTNO     DNAME                          LOC
---------- ------------------------------ -----------
       10  ACCOUNTING                     NEW YORK
       20  RESEARCH                       DALLAS
       30  SALES                          CHICAGO
       40  OPERATIONS                     BOSTON
       50  ADVANCED ANALYSIS              CA
       60  PIC                            CA
       70  ESCALATIONS CENTER             CA
       50  SERVER TECHNOLOGY              CA
8 rows selected.

SVRMGR> select TABLESPACE_NAME,STATUS  from dba_tablespaces;
TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
RBS                            ONLINE
TEMP                           ONLINE
TOOLS                          ONLINE
USERS                          ONLINE
OBJ                            ONLINE
WEEK1                          ONLINE
7 rows selected.
SVRMGR> select SEGMENT_NAME,STATUS from dba_rollback_segs;
SEGMENT_NAME                   STATUS
------------------------------ ----------------
SYSTEM                         ONLINE
R01                            OFFLINE
R02                            OFFLINE
R03                            OFFLINE
R04                            OFFLINE
5 rows selected.
SVRMGR> alter rollback segment R01 online;
alter rollback segment R01 online
*
ORA-01698: a clone database may only have SYSTEM rollback segment online

%exp sys/change_on_install point_in_time_recover=y recovery_tablespaces=week1

Export: Release 8.0.3.0.0 - Production on Sat Jul 5 17:15:37 1997

(c) Copyright 1997 Oracle Corporation.  All rights reserved.
Connected to: Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
Export done in US7ASCII character set and US7ASCII NCHAR character set
Note: table data (rows) will not be exported

About to export Tablespace Point-in-time Recovery objects...
For tablespace WEEK1 ...
. exporting cluster definitions
. exporting table definitions
. . exporting table            DEPT
. . exporting table            EMP
. exporting referential integrity constraints
. exporting triggers
. end point-in-time recovery
Export terminated successfully without warnings.


p.526
EXPORT:V08.00.03
DSYS
RTPITR
1024
0
530
4000
EXECUTE sys.dbms_pitr.beginImport('8.0.0.0.0',3404103021,105867,305725322,126177);
EXECUTE sys.dbms_pitr.beginTablespace(7,126081);
EXECUTE sys.dbms_pitr.doFileVerify(7,7,126177,126156,305743714,5242880);
EXECUTE sys.dbms_pitr.endTablespace(126177,126156,305743714);
EXECUTE sys.dbms_pitr.commitPitr;
CONNECT GS
TABLE "DEPT"
CREATE TABLE "DEPT" ("DEPTNO" NUMBER(2, 0), "DNAME" VARCHAR2(30), "LOC" VARCHAR2(13))  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING STORAGE(SEG_FILE 7 SEG_BLOCK 7 OBJNO_REUSE 3057 INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAXEXTENTS 121 PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "WEEK1"
TABLE "EMP"
CREATE TABLE "EMP" ("EMPNO" NUMBER(4, 0) NOT NULL ENABLE, "ENAME" VARCHAR2(10), "JOB" VARCHAR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE, "SAL" NUMBER(7, 2), "COMM" NUMBER(7, 2), "DEPTNO" NUMBER(2, 0))  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING STORAGE(SEG_FILE 7 SEG_BLOCK 2 OBJNO_REUSE 3056 INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAXEXTENTS 121 PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "WEEK1"
ENDTABLE
EXECUTE sys.dbms_pitr.endImport;
EXIT


p.527-530
SVRMGR> select TABLESPACE_NAME,STATUS from dba_tablespaces;
TABLESPACE_NAME                STATUS
------------------------------ ------
SYSTEM                         ONLINE
RBS                            ONLINE
TEMP                           ONLINE
TOOLS                          ONLINE
USERS                          ONLINE
OBJ                            ONLINE
WEEK1                          OFFLINE
7 rows selected.
SVRMGR> 

SVRMGR> select name,status from v$datafile;
NAME                                                         STATUS
------------------------------------------------------------ ------
/u03/oradata/V803/system01.dbf                               SYSTEM
/u03/oradata/V803/rbs01.dbf                                  ONLINE
/u03/oradata/V803/temp01.dbf                                 ONLINE
/u03/oradata/V803/tools01.dbf                                ONLINE
/u03/oradata/V803/users01.dbf                                ONLINE
/u03/oradata/V803/obj.dbf                                    ONLINE
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf      RECOVER
7 rows selected.

SVRMGR> connect gs/gs
Connected.
SVRMGR> select * from emp;
select * from emp
              *
ORA-00942: table or view does not exist

%imp sys/change_on_install point_in_time_recover=y log=imp.log

Connected to: Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production

Export file created by EXPORT:V08.00.03 via conventional path
About to import Tablespace Point-in-time Recovery objects...
IMP-00017: following statement failed with ORACLE error 29300:
 "BEGIN   sys.dbms_pitr.beginTablespace(7,126081); END;"
IMP-00003: ORACLE error 29300 encountered
ORA-29300: ORACLE error, tablespace point-in-time recovery
ORA-29314: tablespace 'WEEK1' is not OFFLINE FOR RECOVER nor READ ONLY
IMP-00017: following statement failed with ORACLE error 1403:
 "BEGIN   sys.dbms_pitr.commitPitr; END;"
IMP-00003: ORACLE error 1403 encountered
ORA-01403: no data found
ORA-06512: at "SYS.DBMS_PITR", line 1115
ORA-06512: at line 1
. importing GS's objects into GS
IMP-00017: following statement failed with ORACLE error 1187:
 "CREATE TABLE "DEPT" ("DEPTNO" NUMBER(2, 0), "DNAME" VARCHAR2(30), "LOC" VAR"
 "CHAR2(13))  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING STORAGE(S"
 "EG_FILE 7 SEG_BLOCK 7 OBJNO_REUSE 3057 INITIAL 10240 NEXT 10240 MINEXTENTS "
 "1 MAXEXTENTS 121 PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL D"
 "EFAULT) TABLESPACE "WEEK1""
IMP-00003: ORACLE error 1187 encountered
ORA-01187: cannot read from file 7 because it failed verification tests
ORA-01110: data file 7: '/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf'
IMP-00017: following statement failed with ORACLE error 1187:
 "CREATE TABLE "EMP" ("EMPNO" NUMBER(4, 0) NOT NULL ENABLE, "ENAME" VARCHAR2("
 "10), "JOB" VARCHAR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE, "SAL" NUMBER(7"
 ", 2), "COMM" NUMBER(7, 2), "DEPTNO" NUMBER(2, 0))  PCTFREE 10 PCTUSED 40 IN"
 "ITRANS 1 MAXTRANS 255 LOGGING STORAGE(SEG_FILE 7 SEG_BLOCK 2 OBJNO_REUSE 30"
 "56 INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAXEXTENTS 121 PCTINCREASE 50 FREE"
 "LISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "WEEK1""
IMP-00003: ORACLE error 1187 encountered
ORA-01187: cannot read from file 7 because it failed verification tests
ORA-01110: data file 7: '/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf'
IMP-00017: following statement failed with ORACLE error 29301:
 "BEGIN   sys.dbms_pitr.endImport; END;"
IMP-00003: ORACLE error 29301 encountered
ORA-29301: wrong DBMS_PITR package function/procedure order
ORA-06512: at "SYS.DBMS_PITR", line 1131
ORA-06512: at line 1
Import terminated successfully with warnings.

svrmgr> alter tablespace week1 offline for recover;

%imp sys/change_on_install point_in_time_recover=y log=imp.log

Connected to: Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production

Export file created by EXPORT:V08.00.03 via conventional path
About to import Tablespace Point-in-time Recovery objects...
. importing GS's objects into GS
. . importing table                         "DEPT"
. . importing table                          "EMP"
Import terminated successfully without warnings.
SVRMGR> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME                  STATUS
------------------------------   ------
SYSTEM                           ONLINE
RBS                              ONLINE
TEMP                             ONLINE
TOOLS                            ONLINE
USERS                            ONLINE
OBJ                              ONLINE
WEEK1                            OFFLINE
7 rows selected.
SVRMGR> select name,status from v$datafile;
NAME                                                          STATUS
------------------------------------------------------------- ------
/u03/oradata/V803/system01.dbf                                SYSTEM
/u03/oradata/V803/rbs01.dbf                                   ONLINE
/u03/oradata/V803/temp01.dbf                                  ONLINE
/u03/oradata/V803/tools01.dbf                                 ONLINE
/u03/oradata/V803/users01.dbf                                 ONLINE
/u03/oradata/V803/obj.dbf                                     ONLINE
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf       RECOVER
7 rows selected.
SVRMGR> connect gs/gs
Connected.
SVRMGR> select * from emp;
EMPNO ENAME   JOB        MGR  HIREDATE   SAL   COMM  DEPTNO
----- ------  ---------- ---- ---------- ----- ----- ------
ORA-00376: file 7 cannot be read at this time
ORA-01110: data file 7: '/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf'
SVRMGR> alter tablespace week1 online;
Statement processed.

SVRMGR> select * from emp;
EMPNO ENAME   JOB        MGR  HIREDATE   SAL   COMM  DEPTNO
----- ------  ---------- ---- ---------- ----- ----- ------
7369  SMITH   CLERK      7902 17-DEC-80  800         20
7499  ALLEN   SALESMAN   7698 20-FEB-81  1600  300   30
7521  WARD    SALESMAN   7698 22-FEB-81  1250  500   30
7566  JONES   MANAGER    7839 02-APR-81  2975        20
7654  MARTIN  SALESMAN   7698 28-SEP-81  1250  1400  30
7698  BLAKE   MANAGER    7839 01-MAY-81  2850        30
7782  CLARK   MANAGER    7839 09-JUN-81  2450        10
7788  SCOTT   ANALYST    7566 09-DEC-82  3000        20
7839  KING    PRESIDENT       17-NOV-81  5000        10
7844  TURNER  SALESMAN   7698 08-SEP-81  1500  0     30
7876  ADAMS   CLERK      7788 12-JAN-83  100         20
7900  JAMES   CLERK      7698 03-DEC-81  950         30
7902  FORD    ANALYST    7566 03-DEC-81  3000        20
7934  MILLER  CLERK      7782 23-JAN-82  1300        10
14 rows selected.

SVRMGR> select * from dept;
DEPTNO     DNAME                          LOC
---------- ------------------------------ ---------
       10  ACCOUNTING                     NEW YORK
       20  RESEARCH                       DALLAS
       30  SALES                          CHICAGO
       40  OPERATIONS                     BOSTON
       50  ADVANCED ANALYSIS              CA
       60  PIC                            CA
       70  ESCALATIONS CENTER             CA
       50  SERVER TECHNOLOGY              CA
8 rows selected.


p.530-531
SVRMGR> connect internal
Connected.
SVRMGR> 
SVRMGR> select to_char(sysdate,'YY-MON-DD:HH24:MI:SS') from dual;
TO_CHAR(SYSDATE,'Y
------------------
97-JUL-06:15:04:19
1 row selected.
SVRMGR> alter database backup controlfile to 
'/home/usupport/gsinghal/clone/backup01.ctl';
Statement processed.
SVRMGR> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.


p.531-533
SVRMGR> connect internal
Connected.
SVRMGR> startup
ORACLE instance started.
Total System Global Area               5131060 bytes
Fixed Size                               44924 bytes
Variable Size                          4152248 bytes
Database Buffers                        409600 bytes
Redo Buffers                            524288 bytes
Database mounted.
Database opened.
SVRMGR> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME                STATUS   
----------------------------   ---------
SYSTEM                         ONLINE   
RBS                            ONLINE   
TEMP                           ONLINE   
TOOLS                          ONLINE   
USERS                          ONLINE   
OBJ                            ONLINE   
WEEK1                          ONLINE   
WEEK2                          ONLINE   
WEEK3                          ONLINE   
WEEK52                         ONLINE   
10 rows selected.
SVRMGR> select name,status from v$datafile;
NAME                                                       STATUS 
----------------------------------------------------       -------
/u03/oradata/V803/system01.dbf                             SYSTEM 
/u03/oradata/V803/rbs01.dbf                                ONLINE 
/u03/oradata/V803/temp01.dbf                               ONLINE 
/u03/oradata/V803/tools01.dbf                              ONLINE 
/u03/oradata/V803/users01.dbf                              ONLINE 
/u03/oradata/V803/obj.dbf                                  ONLINE 
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf    ONLINE 
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week2.dbf    ONLINE 
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week3.dbf    ONLINE 
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week52.dbf   ONLINE 
10 rows selected.

SVRMGR> connect gs/gs
Connected.
SVRMGR> select * from sales partition(p1);
ACCT_NO    PERSON                         SALES_AMOU    WEEK_NO   
---------- ------------------------------ ----------    ----------
1000       JACK                           10000         3
1 row selected.
SVRMGR> insert into sales values (5000,'DAWN',9999999,2);
1 row processed.
SVRMGR> commit;
Statement processed.
SVRMGR> select * from sales partition(p1);
ACCT_NO    PERSON                         SALES_AMOU    WEEK_NO   
---------- ------------------------------ ----------    ----------
1000       JACK                           10000         3
5000       DAWN                           9999999       2
2 rows selected.
SVRMGR> 
SVRMGR> 
SVRMGR> select to_char(sysdate,'YY-MON-DD:HH24:MI:SS') from dual;
TO_CHAR(SYSDATE,'Y
------------------
97-JUL-06:15:14:48
1 row selected.
SVRMGR> alter table sales drop partition p1;
Statement processed.
SVRMGR> 
SVRMGR> 
SVRMGR> select TABLE_NAME,PARTITION_NAME,HIGH_VALUE, TABLESPACE_NAME from sys.user_tab_partitions;

TABLE_NAME         PARTITION_NAME      HIGH_VALUE       TABLESPACE_NAME 
------------------ ------------------- ---------------- ---------------
SALES              P2                  8                WEEK2 
SALES              P3                  12               WEEK3 
SALES              P4                  MAXVALUE         WEEK52 
3 rows selected.
SVRMGR> alter tablespace week1 offline;
Statement processed.
SVRMGR> insert into sales values (6000,'GAUTAM',9999999,1);
ORA-01502: index 'GS.SYS_C00965' or partition of such index is in unusable state
SVRMGR> 
SVRMGR> 
SVRMGR> select INDEX_NAME,PARTITION_NAME,HIGH_VALUE,STATUS,
     2> TABLESPACE_NAME from sys.user_ind_partitions;

INDEX_NAME   PARTITION_NAME    HIGH_VALUE     STATUS    TABLESPACE_NAME 
------------ ----------------- -------------- --------- ----------------
0 rows selected.
SVRMGR> select index_name,index_type,table_name,status from sys.user_indexes;
INDEX_NAME          INDEX_TYPE   TABLE_NAME                     STATUS  
------------------- ------------ ------------------------------ --------
SYS_C00965          NORMAL       SALES                          UNUSABLE
1 row selected.

SVRMGR> alter system archive log current;
Statement processed.
SVRMGR> select tablespace_name,status from sys.dba_tablespaces;
TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
RBS                            ONLINE
TEMP                           ONLINE
TOOLS                          ONLINE
USERS                          ONLINE
OBJ                            ONLINE
WEEK1                          OFFLINE
WEEK2                          ONLINE
WEEK3                          ONLINE
WEEK52                         ONLINE
10 rows selected.


p.533-536
SVRMGR> startup nomount pfile=/home/usupport/gsinghal/clone/initCLONE.ora
ORACLE instance started.
Total System Global Area       5131060 bytes
Fixed Size                               44924 bytes
Variable Size                          4152248 bytes
Database Buffers                        409600 bytes
Redo Buffers                            524288 bytes
SVRMGR> alter database mount CLONE database;
Statement processed.
SVRMGR> select name,status from v$datafile;
NAME                                                       STATUS
--------------------------------------------               -------
/home/usupport/gsinghal/clone/system01.dbf                 SYSOFF
/home/usupport/gsinghal/clone/rbs01.dbf                    OFFLINE
/home/usupport/gsinghal/clone/temp01.dbf                   OFFLINE
/home/usupport/gsinghal/clone/tools01.dbf                  OFFLINE
/home/usupport/gsinghal/clone/users01.dbf                  OFFLINE
/home/usupport/gsinghal/clone/obj.dbf                      OFFLINE
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf    OFFLINE
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week2.dbf    OFFLINE
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week3.dbf    OFFLINE
/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week52.dbf   OFFLINE
10 rows selected.
SVRMGR> alter database rename file 
'/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf' to 
'/home/usupport/gsinghal/clone/week1.dbf';
Statement processed.
SVRMGR> alter database rename file 
'/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week2.dbf' to 
'/home/usupport/gsinghal/clone/week2.dbf';
Statement processed.
SVRMGR> alter database rename file 
'/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week3.dbf' to 
'/home/usupport/gsinghal/clone/week3.dbf';
Statement processed.
SVRMGR> alter database rename file 
'/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week52.dbf' to 
'/home/usupport/gsinghal/clone/week52.dbf';
Statement processed.
SVRMGR> alter database datafile 
'/home/usupport/gsinghal/clone/system01.dbf' online;
Statement processed.
SVRMGR> alter database datafile 
'/home/usupport/gsinghal/clone/rbs01.dbf' online;
Statement processed.
SVRMGR> alter database datafile 
'/home/usupport/gsinghal/clone/temp01.dbf' online;
Statement processed.

SVRMGR> alter database datafile 
'/home/usupport/gsinghal/clone/week1.dbf' online;
Statement processed.
SVRMGR> select name,status from v$datafile;
NAME                                                      STATUS
-------------------------------------------------------   ----------
/home/usupport/gsinghal/clone/system01.dbf                SYSTEM
/home/usupport/gsinghal/clone/rbs01.dbf                   ONLINE
/home/usupport/gsinghal/clone/temp01.dbf                  ONLINE
/home/usupport/gsinghal/clone/tools01.dbf                 OFFLINE
/home/usupport/gsinghal/clone/users01.dbf                 OFFLINE
/home/usupport/gsinghal/clone/obj.dbf                     OFFLINE
/home/usupport/gsinghal/clone/week1.dbf                   ONLINE 
/home/usupport/gsinghal/clone/week2.dbf                   OFFLINE
/home/usupport/gsinghal/clone/week3.dbf                   OFFLINE
/home/usupport/gsinghal/clone/week52.dbf                  OFFLINE
10 rows selected.
SVRMGR> 
SVRMGR> recover database using backup controlfile until time 
'1997-07-06:15:14:48';
ORA-00279: change 126282 generated at 07/05/97 16:11:44 needed for thread 1
ORA-00289: suggestion : /u03/app/oracle/product/8.0.3/dbs/arch1_5.dbf
ORA-00280: change 126282 for thread 1 is in sequence #5
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
Log applied.
Media recovery complete.
SVRMGR> alter database open resetlogs;
Statement processed.

SVRMGR> create table swap_p1 (acct_no number(5),person varchar2(30),
sales_amount number(8), week_no number(2)) tablespace week1;
create table swap_p1 (acct_no number(5),person varchar2(30), sales_amount number(8),
*
ERROR at line 1:
ORA-01552: cannot use system rollback segment for non-system tablespace 'WEEK1'

SVRMGR> create table swap_p1 (acct_no number(5) unique,person varchar2(30),
sales_amount number(8),  week_no number(2)) tablespace system;

Table created.

SVRMGR> select index_name,table_name,tablespace_name,status from sys.user_indexes;

INDEX_NAME            TABLE_NAME      TABLESPACE_NAME   STATUS
--------------------- --------------- ----------------- ------
SYS_C00965            SALES           TOOLS             VALID
SYS_C00966            SWAP_P1         SYSTEM            VALID

SVRMGR> alter table sales exchange partition p1  with table swap_p1;
alter table sales exchange partition p1
*
ERROR at line 1:
ORA-14097: column type or size mismatch in ALTER TABLE EXCHANGE PARTITION

SVRMGR> desc sales;
 Name                        Null?               Type
 ---------------------       ----------          ------------
 ACCT_NO                                         NUMBER(5)
 PERSON                      NOT NULL            VARCHAR2(30)
 SALES_AMOUNT                NOT NULL            NUMBER(8)
 WEEK_NO                     NOT NULL            NUMBER(2)

SVRMGR> desc swap_p1;
 Name                            Null?           Type
 ------------------------------- ------          ------
 ACCT_NO                                         NUMBER(5)
 PERSON                                          VARCHAR2(30)
 SALES_AMOUNT                                    NUMBER(8)
 WEEK_NO                                         NUMBER(2)

SVRMGR> drop table swap_p1;

Table dropped.

SVRMGR> create table swap_p1 (acct_no number(5) unique,person varchar2(30) not null, sales_amount NUMBER(8) NOT NULL,week_no NUMBER(2) NOT NULL) tablespace system;

Table created.

SVRMGR> alter table sales exchange partition p1 with table swap_p1;

Table altered.

%exp sys/change_on_install point_in_time_recover=y recovery_tablespaces=week1

Connected to: Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production
Export done in US7ASCII character set and US7ASCII NCHAR character set
Note: table data (rows) will not be exported

About to export Tablespace Point-in-time Recovery objects...
EXP-00008: ORACLE error 29308 encountered
ORA-29308: view TS_PITR_CHECK failure
ORA-06512: at "SYS.DBMS_PITR", line 745
ORA-06512: at line 1
EXP-00000: Export terminated unsuccessfully

SVRMGR> select TABLE_NAME,PARTITION_NAME,HIGH_VALUE, TABLESPACE_NAME from sys.user_tab_partitions;
TABLE_NAME         PARTITION_NAME      HIGH_VALUE        TABLESPACE_NAME
------------------ ------------------- ----------------- ---------------
SALES              P1                  4                 SYSTEM
SALES              P2                  8                 WEEK2
SALES              P3                  12                WEEK3
SALES              P4                  MAXVALUE          WEEK52


p.537-538
SVRMGR> select *
  2>  from sys.ts_pitr_check
  3>  where (ts1_name in ('WEEK1')
  4>  and ts2_name not in ('WEEK1'))
  5>  or
  6>  (ts1_name not in ('WEEK1')
  7>  and ts2_name in ('WEEK1'));

owner1 name1 subname1 obj1type ts1_name name2 subname2 obj2type owner2 ts2_name cname reason
------ ----- -------- -------- -------- ----- -------- -------- ------ -------- ----- ----------
GS     SWAP_P1        TABLE    WEEK1    SYS_C00984     INDEX    GS     SYSTEM         Tables and
                                                                                      associated
                                                                                      indexes not
                                                                                      fully
                                                                                      contained
                                                                                      in the
                                                                                      recovery set

SVRMGR> alter table swap_p1 drop constraints SYS_c00984;

Table altered

%exp sys/change_on_install point_in_time_recover=y recovery_tablespaces=week1

EXPORT:V08.00.03
DSYS
RTPITR
1024
0
530
4000
EXECUTE sys.dbms_pitr.beginImport('8.0.0.0.0',3404103021,105867,305725322,126490);
EXECUTE sys.dbms_pitr.beginTablespace(7,126081);
EXECUTE sys.dbms_pitr.doFileVerify(7,7,126490,126333,305826450,5242880);
EXECUTE sys.dbms_pitr.endTablespace(126490,126333,305826450);
EXECUTE sys.dbms_pitr.commitPitr;
CONNECT GS
TABLE "DEPT"
CREATE TABLE "DEPT" ("DEPTNO" NUMBER(2, 0), "DNAME" VARCHAR2(30), "LOC" VARCHAR2(13))  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING STORAGE(SEG_FILE 7 SEG_BLOCK 7 OBJNO_REUSE 3057 INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAXEXTENTS 121 PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "WEEK1"
TABLE "EMP"
CREATE TABLE "EMP" ("EMPNO" NUMBER(4, 0) NOT NULL ENABLE, "ENAME" VARCHAR2(10), "JOB" VARCHAR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE, "SAL" NUMBER(7, 2), "COMM" NUMBER(7, 2), "DEPTNO" NUMBER(2, 0))  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING STORAGE(SEG_FILE 7 SEG_BLOCK 2 OBJNO_REUSE 3056 INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAXEXTENTS 121 PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "WEEK1"
TABLE "SWAP_P1"
CREATE TABLE "SWAP_P1" ("ACCT_NO" NUMBER(5, 0), "PERSON" VARCHAR2(30) NOT NULL ENABLE, "SALES_AMOUNT" NUMBER(8, 0) NOT NULL ENABLE, "WEEK_NO" NUMBER(2, 0) NOT NULL ENABLE)  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING STORAGE(SEG_FILE 7 SEG_BLOCK 12 OBJNO_REUSE 3074 INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 121 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "WEEK1"
ENDTABLE
EXECUTE sys.dbms_pitr.endImport;
EXIT
Now we perform the import on the production database.
%imp sys/change_on_install point_in_time_recover=y log=imp.log

Connected to: Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production
With the Partitioning and Objects options
PL/SQL Release 8.0.3.0.0 - Production

Export file created by EXPORT:V08.00.03 via conventional path
About to import Tablespace Point-in-time Recovery objects...
. importing GS's objects into GS
. . importing table                         "DEPT"
. . importing table                          "EMP"
. . importing table                      "SWAP_P1"
Import terminated successfully without warnings.


p.538-539
SVRMGR>
SVRMGR> select TABLE_NAME,PARTITION_NAME,HIGH_VALUE,
   TABLESPACE_NAME from sys.user_tab_partitions;

Table      Partition  High Value           Tablespace
---------- ---------- -------------------- ----------
SALES      P2         8                    WEEK2
SALES      P3         12                   WEEK3
SALES      P4         MAXVALUE             WEEK52

SVRMGR> select * from swap_p1;
select * from swap_p1
              *
ERROR at line 1:
ORA-00376: file 7 cannot be read at this time
ORA-01110: data file 7:
'/u03/app/oracle/product/8.0.3/sqlplus/doc/obj/week1.dbf'

SVRMGR> alter tablespace week1 online;

Tablespace altered.

SVRMGR>  select * from swap_p1;

ACCT_NO    PERSON                 SALES_AMOUNT    WEEK_NO
---------- ---------------------- --------------- ---------------
1000       JACK                   10000           3
5000       DAWN                   9999999         2

SVRMGR> 
SVRMGR> alter table sales split partition P2 at (4) into ( partition P1 tablespace week1,partition P2);

Table altered.
SVRMGR> 
SVRMGR> select TABLE_NAME,PARTITION_NAME,HIGH_VALUE,
   TABLESPACE_NAME from sys.user_tab_partitions;
Table      Partition  High Value           Tablespace
---------- ---------- -------------------- ----------
SALES      P2         8                    WEEK2
SALES      P3         12                   WEEK3
SALES      P4         MAXVALUE             WEEK52
SALES      P1         4                    WEEK1

SVRMGR> select * from sales partition (p1);

no rows selected

SVRMGR> alter table sales exchange partition p1 with table swap_p1;

Table altered.

SVRMGR> select * from sales partition(p1);
ACCT_NO    PERSON                         SALES_AMOU    WEEK_NO
---------- ------------------------------ ----------    ----------
1000       JACK                           10000         3
5000       DAWN                           9999999       2

SVRMGR> drop table swap_p1;

Table dropped.



AppendixA
p.545
SELECT ename, empno AS id FROM emp ORDER BY id;


p.547
ALTER TABLESPACE tablespace_name READ ONLY;
ALTER TABLESPACE tablespace_name READ WRITE;


p.548
RECOVER DATABASE PARALLEL DEGREE 5 INSTANCES 2;


p.549
SELECT  /* + FULL(table_name) PARALLEL (table_name 5) */ column FROM table_name;

CREATE TABLE table_name(column_name type) PARALLEL (DEGREE 5 INSTANCES 2);

ALTER TABLE table_name PARALLEL (DEGREE 4);


p.550
CREATE INDEX index_name ON table_name (column_name) PARALLEL (DEGREE 4);


SQLLOAD USERID=SCOTT/TIGER CONTROL=LOAD1.CTL DIRECT=TRUE PARALLEL=TRUE


p.551
CREATE TABLE emp_sal (empno, comm CHECK (comm < 2000), sal NOT NULL)
UNRECOVERABLE
PARALLEL (DEGREE 3)
AS SELECT empno, comm, sal FROM emp;


p.552
ALTER DATABASE DATAFILE 'filename' 50M;

ALTER DATABASE DATAFILE 'filename' AUTOEXTEND OFF;

ALTER DATABASE DATAFILE 'filename' AUTOEXTEND ON NEXT 100K MAXSIZE 250M;


p.559-561
SQL> set echo off
Create a partition table with partitions p1 and p2 in the user's default tablespace and partition p3 in the USER_DATA tablespace.
SQL> create table aa(a number, b varchar2(10))
  2  partition by range(a)
  3  (partition p1 values less than(10) tablespace user_data,
  4  partition p2 values less than(20) tablespace user_data,
  5  partition p3 values less than(30) tablespace user_data);
Table created.
SQL>
SQL> set echo off
Verify through the Data Dictionary
SQL> select table_name, partition_name, high_value, tablespace_name
  2  from user_tab_partitions where table_name = 'AA';
TABLE_NAME PARTITION_ HIGH_VALUE TABLESPACE_NAME
---------- ---------- ---------- ----------------
AA         P2         20         USER_DATA
AA         P3         30         USER_DATA
AA         P1         10         USER_DATA
3 rows selected.
SQL> set echo off
Insert rows using the partition-extended name
SQL> insert into aa partition (p1) values (1,'Rama');
1 row created.
SQL> set echo off
Attempt to insert an invalid value
SQL> insert into aa partition (p2) values (2,'Double A');
insert into aa partition (p2) values (2,'Double A')
            *
ERROR at line 1:
ORA-14401: inserted partition key is outside specified partition
SQL> set echo off
Insert the above value into the table
SQL> insert into aa values (2,'Double A');
1 row created.
SQL> set echo off
Perform a full table scan for all rows
SQL> select * from aa where a < 4;
        A B
--------- ----------
        1 Rama
        2 Double A
2 rows selected.
SQL> set echo off
Create a local index
SQL> create unique index local_aa on aa(a) local;
Index created.
SQL> set echo off
Verify local index existence from the Data Dictionary
SQL> select index_name, partition_name, high_value, status, tablespace_name
  2  from user_ind_partitions where index_name = 'LOCAL_AA';
INDEX_NAME   PARTITION_ HIGH_VALUE STATUS   TABLESPACE_NAME
------------ ---------- ---------- -------- ----------------
LOCAL_AA     P1         10         USABLE   USER_DATA
LOCAL_AA     P2         20         USABLE   USER_DATA
LOCAL_AA     P3         30         USABLE   USER_DATA
3 rows selected.
SQL> set echo off
Split partition P2
SQL> alter table aa split partition p2 at (15)
  2  into (partition p4,
  3         partition p2);
Table altered.
SQL> set echo off
Verify that the split occurred from the Data Dictionary
SQL> select table_name, partition_name, high_value, tablespace_name
  2  from user_tab_partitions where table_name = 'AA';
TABLE_NAME PARTITION_ HIGH_VALUE TABLESPACE_NAME
---------- ---------- ---------- ----------------
AA         P2         20         USER_DATA
AA         P3         30         USER_DATA
AA         P4         15         USER_DATA
AA         P1         10         USER_DATA
4 rows selected.
SQL> exit


p.561
SQL> alter session enable parallel dml;
Session altered.
SQL> update /*+ parallel(emp,3) */ emp
  2  set sal=sal * 1.5 where job = 'CLERK' and
  3  deptno in (select deptno from dept where
  4  loc = 'DALLAS');
2 rows updated.
SQL> commit;
Commit complete.


p.561-562
Create the NAME_TYPE object type
SQL> create or replace type name_type as object
  2   (first varchar2(20), last varchar2(20));
Type created.
SQL> set echo off
View the listing of the names and types
SQL> select attr_name, attr_type_name, length
  2  from user_type_attrs
  3  where type_name = 'NAME_TYPE';
ATTR_NAME                    ATTR_TYPE_NAME                    LENGTH
---------------------------- ------------------------------ ---------
FIRST                        VARCHAR2                              20
LAST                         VARCHAR2                              20
SQL> set echo off
Create an object table, which contains an OID
SQL> create table name_ot of name_type;
Table created.
SQL> set echo off
Insert rows into the object table
SQL> insert into name_ot values ('Jerry', 'Rice');
1 row created.
SQL> insert into name_ot values ('Steve','Young');
1 row created.
SQL> commit;
Commit complete.
SQL> set echo off
View the table's contents
SQL> select first ||' '||last "CLASSY NINERS" from name_ot;
CLASSY NINERS
-----------------------------------------
Jerry Rice
Steve Young
SQL> set echo off
Update one of the object table's rows
SQL> update name_ot
  2  set first = 'Mr'
  3  where last = 'Rice';
1 row updated.
SQL> commit;
Commit complete.
SQL> set echo off
Create a relational table with a column object
SQL> create table name_rt
  2  ( id    number,
  3    name  name_type );
Table created.
SQL> set echo off
Insert rows into the relational table using the constructor
SQL> insert into name_rt values (1, name_type('Barry ','Bonds'));
1 row created.
SQL> insert into name_rt values (2, name_type('Rod','Beck'));
1 row created.
SQL> commit;
Commit complete.


p.563
SQL> connect system/manager
Connected.
SQL> create user aa identified by aa;
User created.
SQL> grant connect,resource to aa;
Grant succeeded.
SQL> create profile demo limit
  2  failed_login_attempts 3
  3  password_grace_time 3
  4  /
Profile created.
SQL> alter user aa profile demo;
User altered.


p.565-566
REM First create an object type to store phone number data
SQL> create type phone_type as object (
  2  location varchar2(20),
  3  phone_num varchar2 (10));
Type created.
SQL> create type phone_array as varray(4) of phone_type;
Type created.
SQL> create table customers (
  2  cust_name       varchar2(20),
  3  phones          phone_array);
Table created.
SQL> insert into customers values
  2  ('AA', phone_array(phone_type('Office','4155067000')));
1 row created.
SQL> insert into customers values
  2  ('AA', phone_array(phone_type('Pager','8880000000')));
1 row created.
SQL> insert into customers values
  2   ('AA', phone_array(phone_type('Cellphone','98123445')));
1 row created.
SQL> insert into customers values
  2  ('AA', phone_array(phone_type('Residence','4155730000')));
1 row created.
SQL> select * from customers;
CUST_NAME          PHONES(LOCATION, PHONE_NUM)
-----------        -----------------------------------------------
AA                 PHONE_ARRAY(PHONE_TYPE('Office', '4155067000'))
AA                 PHONE_ARRAY(PHONE_TYPE('Residence', '4155730000'))
AA                 PHONE_ARRAY(PHONE_TYPE('Pager', '8880000000'))
AA                 PHONE_ARRAY(PHONE_TYPE('Cellphone', '98123445'))


p.572
SQL> create table index_only (
  2  c1 number,
  3  c2 varchar2(10),
  4  primary key (c1))
  5  organization index tablespace user_data;
Table created.
SQL> select object_name, object_type from user_objects where object_name='INDEX_ONLY';
OBJECT_NAME                OBJECT_TYPE
---------------            ------------
INDEX_ONLY                 TABLE
  
  




