Oracle 11g Zaawansowana Administracja
Spis treści
1Uruchomienie bazy. ........................................................................................................................... 3
1.1Binaria ........................................................................................................................................ 4
1.2Konfiguracja systemu operacyjnego .......................................................................................... 4
1.3Wyłączenie RAC ........................................................................................................................ 4
1.4SPFILE ....................................................................................................................................... 4
1.5Start instancji nomount ............................................................................................................... 5
1.6Start instancji mount ................................................................................................................... 5
1.7Odtwarzanie danych ................................................................................................................... 5
1.7.1Katalogowanie kopii backupu ........................................................................................... 5
1.7.2Przełączenie plików danych ............................................................................................... 6
1.7.3Odtwarzanie redologów ...................................................................................................... 6
1.7.4Controlfile to trace .............................................................................................................. 7
1.7.5Usuwanie nadmiarowych logów z RAC-a ....................................................................... 10
1.8LISTENER ............................................................................................................................... 11
1.8.1Konfiguracja ..................................................................................................................... 11
1.8.2Listener start ..................................................................................................................... 11
1.8.3LISTENER status, services .............................................................................................. 11
1.8.4Rejestracja Bazy w LISTENER ....................................................................................... 12
2Backup bazy. .................................................................................................................................... 13
3Środowisko TIPS ............................................................................................................................. 14
3.1Profile ....................................................................................................................................... 14
3.2glogin.sql .................................................................................................................................. 14
4DBMS_SHEDULER ....................................................................................................................... 15
4.1DBMS_SHEDULE tworzenie program ................................................................................... 15
4.2DBMS_SHEDULE tworzenie schedule ................................................................................... 15
4.3DBMS_SHEDULE tworzenie job-u ........................................................................................ 16
4.4Usuwanie job i program ........................................................................................................... 16
4.5Poprawne kreowanie programu z argumentami ...................................................................... 16
4.6Prawidłowy skrypt uruchamiający backup poprzez dbms_scheduler bez błędów. .................. 17
4.6.1Program ............................................................................................................................ 17
4.6.2Argumenty ........................................................................................................................ 17
4.6.3Enable program................................................................................................................. 18
4.6.4scheduler ........................................................................................................................... 18
4.6.5Job..................................................................................................................................... 18
4.6.6execute job ........................................................................................................................ 18
4.7Parametryzacja (nowy job + argumenty ) ................................................................................ 18
4.7.1Nowy shedule ................................................................................................................... 18
4.7.2Nowy job .......................................................................................................................... 19
4.7.3Nowy argument ................................................................................................................ 19
4.7.4Start nowego jobu ............................................................................................................. 19
4.7.5Test.................................................................................................................................... 19
4.7.6Disable job ........................................................................................................................ 19
4.8 Perspektywy dla dbms_sheduler ............................................................................................. 19
4.8.1DBA_SCHEDULER_PROGRAMS; ............................................................................... 19
4.8.2DBA_SCHEDULER_JOBS; ............................................................................................ 20
4.8.3DBA_SCHEDULER_SCHEDULES; .............................................................................. 20
5ASM ................................................................................................................................................. 20
5.1Instalacja asmlib. ...................................................................................................................... 20
5.2Dysk /dev/xvdb ........................................................................................................................ 21
5.3Konfiguracja asmlib ................................................................................................................. 23
5.4Instalacja grid ........................................................................................................................... 23
5.5Konfiguracja ASM ................................................................................................................... 23
5.5.1Środowisko ....................................................................................................................... 23
5.5.2Podłączenie do instancji asm ............................................................................................ 24
5.5.3Stan diskgrup, dusków ...................................................................................................... 24
5.5.4Administrowanie .............................................................................................................. 24
6Migrowanie bazy do ASM ............................................................................................................... 25
6.1Tworzenie nowej instancji nowy spfile z instniejącego .......................................................... 25
6.2Odtworzenie controlfile............................................................................................................ 27
6.2.1Start bazy orclasm nomount ............................................................................................. 27
6.2.2restore controlfile .............................................................................................................. 27
6.2.3Sprawdzenie czy controlfile jest odtworzony na asm ...................................................... 28
6.2.4Sprawdzenie czy rman zmienił konfiguracje lokalizacji controlfile w spfile................... 28
6.2.5Montowanie bazy ............................................................................................................. 28
6.2.6Restore bazy do ASM ....................................................................................................... 29
6.2.7recover database ............................................................................................................... 31
6.2.8Rekreowanie grup redo. .................................................................................................... 33
6.2.9temp tablespace................................................................................................................. 34
6.2.10Backup przygotowanym skryptme ................................................................................. 35
6.3Rejestracja bazy w grid ............................................................................................................ 35
7Patchowanie bazy danych ................................................................................................................ 35
7.1Instalacja 11.2.0.3 ..................................................................................................................... 35
7.2Pre upgrade script utlu112i.sql ................................................................................................. 35
7.3Rekompilacja obiektów utlrp.sql.............................................................................................. 37
7.4Upgrade .................................................................................................................................... 38
7.4.1Shutdown immediate ........................................................................................................ 38
7.4.2Przeniesienie plików konfiguracyjnych............................................................................ 38
7.4.3Ustawienie nowego ORACLE_HOME ............................................................................ 38
7.4.4Startup upgrade ................................................................................................................. 39
7.4.5Start bazy rekompilacja obiektów .................................................................................... 39
7.4.6Listener ............................................................................................................................. 41
7.4.7Rejestracja nowej bazy w grid .......................................................................................... 41
7.4.8Dodanie tnslsnr do bazy z grida ....................................................................................... 43
7.4.9Dodanie protokołu ftp do bazy ......................................................................................... 44
7.4.10Dostęp ftp ....................................................................................................................... 45
8Clon bazy danych. ............................................................................................................................ 46
8.1Backup ...................................................................................................................................... 46
8.2Create spfile ............................................................................................................................. 46
8.3Plik haseł .................................................................................................................................. 47
8.4Duplikacja ................................................................................................................................ 47
8.4.1Duplikacja z backupu ....................................................................................................... 47
8.5Duplikacja z aktywnej bazy do test2 ........................................................................................ 51
8.5.1Konfiguracja spfile ........................................................................................................... 51
8.5.2Rejestracja statyczna test2 w listener .............................................................................. 52
8.5.3Duplikacja (from active database) .................................................................................... 52
9Uruchomienie bazy w trybie niespójnym ....................................................................................... 58
9.1Symulacja awarii (shutdown immediate). ................................................................................ 58
9.1.1Zatrzymać bazę ................................................................................................................ 58
9.1.2Usunąć asmcmd redologi.................................................................................................. 58
9.1.3Start ................................................................................................................................... 59
9.2Baza nie spójnie zamknięta ...................................................................................................... 59
9.2.1Zatrzymanie bazy (shutdown abort) ................................................................................. 59
9.2.2Ustawienie _allow_resetlogs_corruption ......................................................................... 60
10Odtwarzanie tablespace do punktu w czasie .................................................................................. 61
11DataGuard ...................................................................................................................................... 61
11.1dg_broker ................................................................................................................................ 61
11.2Force loging ............................................................................................................................ 61
11.3Nowa baza st........................................................................................................................... 61
11.4Plik haseł ................................................................................................................................ 63
11.5Test połączenia poprzez nazwy tnsnamed.ora ....................................................................... 63
11.6Duplikacja (for standby) ......................................................................................................... 64
11.7 Dodanie redo standby login ................................................................................................... 66
11.7.1Primary ........................................................................................................................... 66
11.7.2Secondary ....................................................................................................................... 66
11.8Konfiguracja Data Guard (dgmgrl) ........................................................................................ 67
11.8.1Primary ........................................................................................................................... 67
11.8.2Secondary ....................................................................................................................... 67
11.9Włączanie konfiguracji. ......................................................................................................... 68
11.10recover clone database ......................................................................................................... 70
11.11Ponowna duplikacja .............................................................................................................. 70
11.12Włączenie konfiguracji ........................................................................................................ 73
11.13Przełączenie do trybu Active standby (baza st) .................................................................... 73
11.14Switchover ............................................................................................................................ 74
11.15Dodatkowo zarejestrować serwis statyczny dla brokera ...................................................... 75
11.16switchover – st to orclasm .................................................................................................... 76
12Modelowanie SQL ......................................................................................................................... 77
Dzień I
1 Uruchomienie bazy.
Uruchomić po awarii w jak najkrótszym czasie bazę danych.
Do dyspozycji mamy
ORACLE_HOME
Pliki bazy spójnie zamknięte bez redologów,
Baza pracowała na ASM
Linux 64 bity
Nieprawidłowo skonfigurowany system operacyjny shmall
Niezgodna grupa systemowa użytkownia oracle z wpisem w konfiguracji.
1.1 Binaria
Rozpakować archiwum ORACLE_HOME do /u01
Rozpakować archiwum z ORADATA do /u01/oradata
1.2 Konfiguracja systemu operacyjnego
Ustawić shmall w pliku /etc/sysctl.conf przeładować konfigurację sysctl -p.
Skonfigurować środowisko użytkownika oracle
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin
Zweryfikować jaka jest grupa sysdba w pliku $ORACLE_HOME/rdbms/lib/config.c
dodać oracle do grupy która jest w pliku.
1.3 Wyłączenie RAC
Skompilować Oracle do pracy nie RAC.
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk rac_off ioracle
relink all
1.4 SPFILE
Podłączyć się do idle instance i z spfile wykreować pfile
create pfile from spfile
Zmodyfikować pfile usunąć wpisy związane z RAC oraz ścieżki związane z ASM.
Wkleić pfile
1.5 Start instancji nomount
Utworzyć spfile z wyedytowanego pfile.
create spfile from pflie;
startup nomount;
1.6 Start instancji mount
Zmienić nazwę controlfile otrzymanego z archiwum na control.ctl
zmodyfikować konfigurację oracle
alter system set CONTROLFILE='/u01/oradata/control.ctl' scope=spfile;
startup force mount;
1.7 Odtwarzanie danych
1.7.1 Katalogowanie kopii backupu
[oracle@dbaa ~]$ rman target /
Recovery Manager: Release 11.2.0.2.0 - Production on Tue Jan 24 13:52:35 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.
All rights reserved.
connected to target database: ORCL (DBID=1294297143, not open)
RMAN> catalog start with '/u01/oradata'
2> ;
using target database control file instead of recovery catalog
searching for all files that match the pattern /u01/oradata
List of Files Unknown to the Database
=====================================
File Name: /u01/oradata/DEF_TBS.301.772747873
File Name: /u01/oradata/SYSAUX.262.766516415
File Name: /u01/oradata/UNDO1.263.766516415
File Name: /u01/oradata/UNDO2.265.766517033
File Name: /u01/oradata/USERS.275.772285149
File Name: /u01/oradata/SYSTEM.261.766516413
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/oradata/DEF_TBS.301.772747873
File Name: /u01/oradata/SYSAUX.262.766516415
File Name: /u01/oradata/UNDO1.263.766516415
File Name: /u01/oradata/UNDO2.265.766517033
File Name: /u01/oradata/USERS.275.772285149
File Name: /u01/oradata/SYSTEM.261.766516413
1.7.2 Przełączenie plików danych
RMAN> switch database to copy;
datafile
datafile
datafile
datafile
datafile
datafile
1
2
3
4
5
7
switched
switched
switched
switched
switched
switched
to
to
to
to
to
to
datafile
datafile
datafile
datafile
datafile
datafile
copy
copy
copy
copy
copy
copy
"/u01/oradata/SYSTEM.261.766516413"
"/u01/oradata/SYSAUX.262.766516415"
"/u01/oradata/UNDO1.263.766516415"
"/u01/oradata/UNDO2.265.766517033"
"/u01/oradata/USERS.275.772285149"
"/u01/oradata/DEF_TBS.301.772747873"
RMAN>
SQL>
select name from v$datafile;
NAME
-------------------------------------------------------------------------------/u01/oradata/SYSTEM.261.766516413
/u01/oradata/SYSAUX.262.766516415
/u01/oradata/UNDO1.263.766516415
/u01/oradata/UNDO2.265.766517033
/u01/oradata/USERS.275.772285149
/u01/oradata/DEF_TBS.301.772747873
6 rows selected.
SQL>
1.7.3 Odtwarzanie redologów
SQL> show parameters recove
NAME
-----------------------------------db_recovery_file_dest
db_recovery_file_dest_size
db_unrecoverable_scn_tracking
recovery_parallelism
TYPE
----------string
big integer
boolean
integer
VALUE
-----------------------------/u01/flash_recovery_area
4G
TRUE
0
Nie da się odtworzyć bazy z opcją resetlog bo w bazie niema redologów
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery
SQL>
procedura odtworzenia ze zmianą konfiguracji z ASM na filesystem (zmiana ścieżek
i utworzenie plików redo).
1.7.4 Controlfile to trace
SQL> alter database backup controlfile to trace as '/home/oracle/control.sql' resetlogs;
Database altered.
SQL>
plik control.sql
( oryginalny )
[oracle@dbaa ~]$ cat /home/oracle/control.sql
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--- DB_UNIQUE_NAME="orcl"
--- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE
-------
The following commands will create a new control file and use it
to open the database.
Data used by Recovery Manager will be lost.
The contents of online logs will be lost and all backups will
be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS
MAXLOGFILES 64
MAXLOGMEMBERS 5
MAXDATAFILES 30
MAXINSTANCES 32
ARCHIVELOG
MAXLOGHISTORY 10225
LOGFILE
GROUP 1 '+DATA/orcl/onlinelog/group_1.258.766516411'
GROUP 2 '+DATA/orcl/onlinelog/group_2.259.766516411'
GROUP 3 '+DATA/orcl/onlinelog/group_3.260.766516411'
-- STANDBY LOGFILE
DATAFILE
'/u01/oradata/SYSTEM.261.766516413',
'/u01/oradata/SYSAUX.262.766516415',
'/u01/oradata/UNDO1.263.766516415',
'/u01/oradata/UNDO2.265.766517033',
'/u01/oradata/USERS.275.772285149',
'/u01/oradata/DEF_TBS.301.772747873'
CHARACTER SET UTF8
;
SIZE 50M BLOCKSIZE 512,
SIZE 50M BLOCKSIZE 512,
SIZE 50M BLOCKSIZE 512
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE
'/u01/flash_recovery_area/ORCL/archivelog/2012_01_24/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Create log files for threads other than thread one.
ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 4 '+DATA/orcl/onlinelog/group_4.266.766517053' SIZE 50M BLOCKSIZE 512 REUSE,
GROUP 5 '+DATA/orcl/onlinelog/group_5.267.766517057' SIZE 50M BLOCKSIZE 512 REUSE,
GROUP 6 '+DATA/orcl/onlinelog/group_6.268.766517059' SIZE 50M BLOCKSIZE 512 REUSE;
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/orcl/tempfile/temp.264.766516415' REUSE;
-- End of tempfile additions.
--
Plik poprawiony:
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 64
MAXLOGMEMBERS 5
MAXDATAFILES 30
MAXINSTANCES 32
MAXLOGHISTORY 10225
LOGFILE
GROUP 1 '/u01/oradata/group_1.258.766516411' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/oradata/group_2.259.766516411' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/oradata/group_3.260.766516411' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/oradata/SYSTEM.261.766516413',
'/u01/oradata/SYSAUX.262.766516415',
'/u01/oradata/UNDO1.263.766516415',
'/u01/oradata/UNDO2.265.766517033',
'/u01/oradata/USERS.275.772285149',
'/u01/oradata/DEF_TBS.301.772747873'
CHARACTER SET UTF8
;
RECOVER DATABASE until cancel USING BACKUP CONTROLFILE;
ALTER DATABASE OPEN RESETLOGS;
Uruchomienie skryptu nie powidło się .
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Tue Jan 24 14:39:16 2012
Copyright (c) 1982, 2010, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @/home/oracle/control.sql
ORA-01081: cannot start already-running ORACLE - shut it down first
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01100: database already mounted
ORA-00279: change 982099 generated at 01/21/2012 19:21:23 needed for thread 1
ORA-00289: suggestion :
/u01/flash_recovery_area/ORCL/archivelog/2012_01_24/o1_mf_1_48_%u_.arc
ORA-00280: change 982099 for thread 1 is in sequence #48
ORA-00308: cannot open archived log
'/u01/flash_recovery_area/ORCL/archivelog/2012_01_24/o1_mf_1_48_%u_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Database altered.
SQL> select member from v$logfile;
MEMBER
-------------------------------------------------------------------------------/u01/oradata/ORCL/onlinelog/o1_mf_1_7kxf4d8x_.log
/u01/oradata/ORCL/onlinelog/o1_mf_2_7kxf4f6d_.log
/u01/oradata/ORCL/onlinelog/o1_mf_3_7kxf4g1y_.log
/u01/oradata/ORCL/onlinelog/o1_mf_4_7kxf4gvc_.log
/u01/oradata/ORCL/onlinelog/o1_mf_5_7kxf4hnb_.log
/u01/oradata/ORCL/onlinelog/o1_mf_6_7kxf4jcg_.log
6 rows selected.
SQL> show parameters rec
Jeżeli w spfile jest ustawiony OMF lub db_create_file_dest to oracle przy
podniesieniu bazy komendami
RECOVER DATABASE until cancel USING BACKUP CONTROLFILE
ALTER DATABASE OPEN RESETLOGS;
utworzą redologi.
1.7.5 Usuwanie nadmiarowych logów z RAC-a
Ponieważ baza działał jako RAC w konfiguracji pozostały logi od drugiej
instacji.
SQL> select member from v$logfile;
MEMBER
-------------------------------------------------------------------------------/u01/oradata/ORCL/onlinelog/o1_mf_1_7kxf4d8x_.log
/u01/oradata/ORCL/onlinelog/o1_mf_2_7kxf4f6d_.log
/u01/oradata/ORCL/onlinelog/o1_mf_3_7kxf4g1y_.log
/u01/oradata/ORCL/onlinelog/o1_mf_4_7kxf4gvc_.log
/u01/oradata/ORCL/onlinelog/o1_mf_5_7kxf4hnb_.log
/u01/oradata/ORCL/onlinelog/o1_mf_6_7kxf4jcg_.log
Nie da się usunąć zbędnych logów.
SQL> alter system switch logfile;
System altered.
SQL> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-01623: log 4 is current log for instance orcl_2 (thread 2) - cannot drop
ORA-00312: online log 4 thread 2:
'/u01/oradata/ORCL/onlinelog/o1_mf_4_7kxf4gvc_.log'
SQL> alter database drop logfile group 4, group 5, group 6;
alter database drop logfile group 4, group 5, group 6
*
ERROR at line 1:
ORA-01623: log 4 is current log for instance orcl_2 (thread 2) - cannot drop
ORA-00312: online log 4 thread 2:
'/u01/oradata/ORCL/onlinelog/o1_mf_4_7kxf4gvc_.log'
Zablokować thread .
SQL> alter database disable thread 2;
Database altered.
SQL> alter database drop logfile group 4, group 5,
Database altered.
SQL>
group 6;
1.8 LISTENER
1.8.1 Konfiguracja
Skonfigurować listener.ora ręcznie lub netca na porcie 1523.
# listener.ora Network Configuration File:
/u01/app/oracle/database/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.8.8.113 )(PORT = 1523))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
1.8.2 Listener start
[oracle@dbaa admin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 24-JAN-2012 15:13:56
Copyright (c) 1991, 2010, Oracle.
All rights reserved.
Starting /u01/app/oracle/database/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /u01/app/oracle/database/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/dbaa/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.8.8.113)(PORT=1523)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523)))
STATUS of the LISTENER
-----------------------Alias
LISTENER
Version
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date
24-JAN-2012 15:13:56
Uptime
0 days 0 hr. 0 min. 0 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/u01/app/oracle/database/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/dbaa/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.8.8.113)(PORT=1523)))
The listener supports no services
The command completed successfully
1.8.3 LISTENER status, services
[oracle@dbaa admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 24-JAN-2012 15:14:20
Copyright (c) 1991, 2010, Oracle.
All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523)))
STATUS of the LISTENER
-----------------------Alias
LISTENER
Version
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date
24-JAN-2012 15:13:56
Uptime
0 days 0 hr. 0 min. 23 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/u01/app/oracle/database/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File
/u01/app/oracle/diag/tnslsnr/dbaa/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.8.8.113)(PORT=1523)))
The listener supports no services
The command completed successfully
[oracle@dbaa admin]$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 24-JAN-2012 15:14:24
Copyright (c) 1991, 2010, Oracle.
All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523)))
The listener supports no services
The command completed successfully
[oracle@dbaa admin]$
1.8.4 Rejestracja Bazy w LISTENER
SQL> alter system set local_listener = '(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523))'
scope=both;
System altered.
SQL> alter system register;
[oracle@dbaa admin]$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 24-JAN-2012 15:18:42
Copyright (c) 1991, 2010, Oracle.
All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: dbaa.localdomain, pid: 5816>
(ADDRESS=(PROTOCOL=tcp)(HOST=dbaa.localdomain)(PORT=44958))
The command completed successfully
[oracle@dbaa admin]$
2 Backup bazy.
Skrypt backupu:
#!/bin/bash
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export
PATH=/u01/app/oracle/database/product/11.2.0/dbhome_1/bin:/u01/app/11.2.0/grid/bin:/usr/kerberos/bin
:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin
export ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
basedir=/u01/app/oracle/backup
host=`hostname`
backup_dir=`date '+%Y.%m.%d'`
filename=`date '+%Y.%m.%d_%H.%M.%S'`
test -d ${basedir}/${host}/${backup_dir} || mkdir -p ${basedir}/${host}/${backup_dir}
if [ "x$1" = "x0" -o "x$1" = "x1" ]; then
inclevel=$1
rman target / log=${basedir}/${host}/${backup_dir}/backup_${filename}.log << !
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup as compressed backupset incremental level ${inclevel} database format
'${basedir}/${host}/${backup_dir}/data_lv${inclevel}_${filename}.%U';
backup as compressed backupset archivelog all delete all input format
'${basedir}/${host}/${backup_dir}/arch_${filename}.%U';
backup as compressed backupset current controlfile format
'${basedir}/${host}/${backup_dir}/control_${filename}.%U';
backup spfile format '${basedir}/${host}/${backup_dir}/spfile_${filename}.%U';
delete noprompt obsolete recovery window of 7 days;
}
!
else
rman target / log=${basedir}/${host}/${backup_dir}/backup_${filename}.log << !
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup as compressed backupset archivelog all delete all input format
'${basedir}/${host}/${backup_dir}/arch_${filename}.%U';
backup as compressed backupset current controlfile format
'${basedir}/${host}/${backup_dir}/control_${filename}.%U';
backup spfile format '${basedir}/${host}/${backup_dir}/spfile_${filename}.%U';
delete noprompt obsolete recovery window of 7 days;
}
!
fi
Po uruchomieniu skryptu skryp nie kończy się poprawnie ponieważ w controlfile były informacje o
starych backupach ( nie rekreowaliśmy controlfile ) tylko go modyfikowaliśmy.
Należy usunąć z repozytorium z Controlfile informacje o starych backupach.
rman target /
crosscheck archivelog all;
delete expired archivelog all;
crosscheck backupset;
delete expired backupset;
Backup incremental
Backup0 – Backup incremental 1(1) – Backup incremental 1(2) – Backup incremental 1(3)
Backup incremental 1(1)
- zmiany od 0
Backup incremental 1(2)
- zmiany od 1(1)
Backup incremental 1(3)
- zmiany od 1(2)
Backup cumulative
Backup0 – Backup cumulative 1(1) – Backup cumulative 1(2) – Backup cumulative 1(3)
Backup cumulative 1(1)
Backup cumulative 1(2)
Backup cumulative 1(3)
zmiany od 0
zmiany od 0
zmiany od 0
Dzień II
3 Środowisko TIPS
3.1 Profile
[oracle@dbaa ~]$ more .11g
export ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias dgmgrl='rlwrap dgmgrl'
[oracle@dbaa ~]$
3.2 glogin.sql
[oracle@dbaa
[oracle@dbaa
[oracle@dbaa
--- Copyright
~]$ . .11g
~]$ cd $ORACLE_HOME/sqlplus/admin
admin]$ more glogin.sql
(c) 1988, 2005, Oracle.
All Rights Reserved.
--- NAME
-glogin.sql
--- DESCRIPTION
-SQL*Plus global login "site profile" file
--Add any SQL*Plus commands here that are to be executed when a
-user starts SQL*Plus, or uses the SQL*Plus CONNECT command.
--- USAGE
-This script is automatically run
-! env | grep ORACLE
define _editor=vim
4 DBMS_SHEDULER
Wykonanie backupu poprzez dbms_scheduler
Obiekty:
program
-
przygotowany skrypt
schedule
-
kiedy ma być wykonywany
job
-
łączy oba powyższe
4.1 DBMS_SHEDULE tworzenie program
begin
dbms_scheduler.create_program(program_name =>'BACKUP_LV0',
program_type =>'EXECUTABLE',
program_action =>'/home/oracle/mk_backup.sh 0');
end;
/
4.2 DBMS_SHEDULE tworzenie schedule
begin
dbms_scheduler.create_schedule(schedule_name => 'S_BACKUP_LV0',
start_date =>
to_timestamp('25.01.2012:17:00:00','DD.MM.YYYY:HH24:MI:SS'),
repeat_interval => 'FREQ=DAILY');
end;
/
4.3 DBMS_SHEDULE tworzenie job-u
begin dbms_scheduler.create_job (
job_name => 'J_BACKUP_LV0',
program_name => 'BACKUP_LV0',
schedule_name => 'S_BACKUP_LV0',
enabled => TRUE
)
;
end;
/
4.4 Usuwanie job i program
Źle wykreowany program bez argumentów trzeba usunąc job i program
SQL>
2
3
4
begin
dbms_scheduler.drop_job('J_BACKUP_LV0');
end;
/
PL/SQL procedure successfully completed.
SQL>
2
3
4
begin
dbms_scheduler.drop_program('BACKUP_LV0');
end;
/
PL/SQL procedure successfully completed.
SQL>
4.5 Poprawne kreowanie programu z argumentami
begin
dbms_scheduler.create_program(program_name => 'BACKUP_LV0',
program_type => 'EXECUTABLE',
program_action => '/home/oracle/mk_backup.sh');
end;
/
exec dbms_scheduler.set_attribute('BACKUP_LV0','NUMBER_OF_ARGUMENTS','1');
begin
dbms_Scheduler.define_program_Argument(program_name=>'BACKUP_LV0',
argument_position=>1,
argument_type=>'NUMBER',
DEFAULT_VALUE=>'0');
end;
/
exec dbms_scheduler.enable('BACKUP_LV0');
begin
dbms_scheduler.create_job(job_name => 'J_BACKUP_LV0',
schedule_name => 'S_BACKUP_LV0',
program_name => 'BACKUP_LV0',
enabled => TRUE );
end;
/
exec dbms_scheduler.run_job('J_BACKUP_LV0',false);
SQL> SQL> !ps -ef |grep rman
oracle
10802 10797 31 11:29 ?
00:00:01 rman target /
log=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/backup_2012.01.25_11.29.30.log
oracle
10814 10762 0 11:29 pts/3
00:00:00 /bin/bash -c ps -ef |grep rman
SQL>
4.6 Prawidłowy skrypt uruchamiający backup poprzez dbms_scheduler
bez błędów.
4.6.1 Program
begin
dbms_scheduler.create_program(program_name => 'BACKUP_LV0',
program_type => 'EXECUTABLE',
program_action => '/home/oracle/mk_backup.sh');
end;
/
4.6.2 Argumenty
exec dbms_scheduler.set_attribute('BACKUP_LV0','NUMBER_OF_ARGUMENTS','1');
begin
dbms_Scheduler.define_program_Argument(program_name=>'BACKUP_LV0',
argument_position=>1,
argument_type=>'NUMBER',
DEFAULT_VALUE=>'0');
end;
/
4.6.3 Enable program
exec dbms_scheduler.enable('BACKUP_LV0');
4.6.4 scheduler
begin
dbms_scheduler.create_schedule(schedule_name => 'S_BACKUP_LV0'
,start_date =>
to_timestamp('25.01.2012:17:00:00','DD.MM.YYYY:HH24:MI:SS'),
repeat_interval => 'FREQ=DAILY');
end;
/
4.6.5 Job
begin
dbms_scheduler.create_job(job_name => 'J_BACKUP_LV0',
schedule_name => 'S_BACKUP_LV0',
program_name => 'BACKUP_LV0',
enabled => TRUE );
end;
/
4.6.6 execute job
exec dbms_scheduler.run_job('J_BACKUP_LV0',false);
false oznacza odpięcie od sesji.
4.7 Parametryzacja (nowy job + argumenty )
4.7.1 Nowy shedule
begin
dbms_scheduler.create_schedule(schedule_name => 'S_BACKUP_LV1'
,start_date =>
to_timestamp('25.01.2012:12:00:00','DD.MM.YYYY:HH24:MI:SS'),
repeat_interval => 'FREQ=HOURLY; INTERVAL=2');
end;
/
4.7.2 Nowy job
begin
dbms_scheduler.create_job(job_name=>'J_BACKUP_LV1',
program_name=>'BACKUP_LV0',
schedule_name=>'S_BACKUP_LV1');
end;
/
4.7.3 Nowy argument
begin
dbms_scheduler.set_job_argument_value(job_name=>'J_BACKUP_LV1',
argument_position=>1,
argument_value=>1);
end;
/
4.7.4 Start nowego jobu
exec dbms_scheduler.enable('J_BACKUP_LV1');
exec dbms_scheduler.run_job('J_BACKUP_LV1',false);
4.7.5 Test
SQL> !ps -ef | grep rman
oracle
10869 10865 16 11:45 ?
00:00:01 rman target /
log=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/backup_2012.01.25_11.45.36.log
4.7.6 Disable job
SQL> exec dbms_scheduler.disable('J_BACKUP_LV0');
PL/SQL procedure successfully completed.
SQL> exec dbms_scheduler.disable('J_BACKUP_LV1');
PL/SQL procedure successfully completed.
4.8 Perspektywy dla dbms_sheduler
4.8.1 DBA_SCHEDULER_PROGRAMS;
SQL> select PROGRAM_NAME,PROGRAM_TYPE,PROGRAM_ACTION from DBA_SCHEDULER_PROGRAMS where
program_type='EXECUTABLE';
PROGRAM_NAME
PROGRAM_TY PROGRAM_ACTION
------------------------------ ---------- -----------------------------BACKUP_LV0
EXECUTABLE /home/oracle/mk_backup.sh
SQL>
4.8.2 DBA_SCHEDULER_JOBS;
SQL> col PROGRAM_NAME format A30
SQL> select JOB_NAME, PROGRAM_NAME from DBA_SCHEDULER_JOBS;
JOB_NAME
-----------------------------J_BACKUP_LV0
XMLDB_NFS_CLEANUP_JOB
J_BACKUP_LV1
SM$CLEAN_AUTO_SPLIT_MERGE
RSE$CLEAN_RECOVERABLE_SCRIPT
FGR$AUTOPURGE_JOB
BSLN_MAINTAIN_STATS_JOB
DRA_REEVALUATE_OPEN_FAILURES
HM_CREATE_OFFLINE_DICTIONARY
ORA$AUTOTASK_CLEAN
FILE_WATCHER
PROGRAM_NAME
-----------------------------BACKUP_LV0
BACKUP_LV0
BSLN_MAINTAIN_STATS_PROG
ORA$AGE_AUTOTASK_DATA
FILE_WATCHER_PROGRAM
JOB_NAME
PROGRAM_NAME
------------------------------ -----------------------------PURGE_LOG
PURGE_LOG_PROG
MGMT_STATS_CONFIG_JOB
MGMT_CONFIG_JOB
14 rows selected.
4.8.3 DBA_SCHEDULER_SCHEDULES;
SQL> col REPEAT_INTERVAL format A30
SQL> select SCHEDULE_NAME, REPEAT_INTERVAL from DBA_SCHEDULER_SCHEDULES;
SCHEDULE_NAME
-----------------------------S_BACKUP_LV1
S_BACKUP_LV0
BSLN_MAINTAIN_STATS_SCHED
FILE_WATCHER_SCHEDULE
DAILY_PURGE_SCHEDULE
REPEAT_INTERVAL
-----------------------------FREQ=HOURLY; INTERVAL=2
FREQ=DAILY
FREQ=WEEKLY
FREQ=MINUTELY;INTERVAL=10
freq=daily;byhour=3;byminute=0
;bysecond=0
5 ASM
5.1 Instalacja asmlib.
[root@dbaa yum.repos.d]# yum install oracleasm-2.6.18-194.el5.x86_64
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracleasm-2.6.18-194.el5.x86_64 0:2.0.5-1.el5 set to be updated
--> Processing Dependency: oracleasm-support >= 2.0.0 for package: oracleasm-2.6.18-194.el5
--> Running transaction check
---> Package oracleasm-support.x86_64 0:2.1.3-1.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package
Arch
Version
Repository
Size
================================================================================
Installing:
oracleasm-2.6.18-194.el5
x86_64
2.0.5-1.el5
el5_u5_base
25 k
Installing for dependencies:
oracleasm-support
x86_64
2.1.3-1.el5
el5_u5_base
87 k
Transaction Summary
================================================================================
Install
2 Package(s)
Upgrade
0 Package(s)
Total download size: 112 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
| 25 kB
00:00
(2/2): oracleasm-support-2.1.3-1.el5.x86_64.rpm
| 87 kB
00:00
-------------------------------------------------------------------------------Total
66 kB/s | 112 kB
00:01
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 1e5e0159
el5_u5_base/gpgkey
| 1.4 kB
00:00
Importing GPG key 0x1E5E0159 "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>"
from http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing
: oracleasm-support
1/2
Installing
: oracleasm-2.6.18-194.el5
2/2
Installed:
oracleasm-2.6.18-194.el5.x86_64 0:2.0.5-1.el5
Dependency Installed:
oracleasm-support.x86_64 0:2.1.3-1.el5
Complete!
[root@dbaa yum.repos.d]# rpm -i oracleasmlib-2.0.4-1.el5.x86_64.rpm
[root@dbaa yum.repos.d]# rpm -Uvh oracleasm-2.6.18-194.el5xen-2.0.5-1.el5.x86_64.rpm
Preparing...
########################################### [100%]
1:oracleasm-2.6.18-194.el########################################### [100%]
[root@dbaa yum.repos.d]#
[root@dbaa yum.repos.d]# rpm -qa | grep oracle
oracleasm-2.6.18-194.el5-2.0.5-1.el5
oracle-validated-1.0.0-22.el5
oracle-logos-4.9.17-6
oracleasm-support-2.1.3-1.el5
oracleasmlib-2.0.4-1.el5
[root@dbaa yum.repos.d]#
5.2 Dysk /dev/xvdb
fdisk
Disk /dev/xvdb: 20.9 GB, 20971520000 bytes
255 heads, 63 sectors/track, 2549 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot
Start
End
Blocks
Id
System
/dev/xvdb1
/dev/xvdb2
1
126
125
2549
1004031
19470780
83
83
Linux
Linux
Id
System
Command (m for help): m
Command action
a
toggle a bootable flag
b
edit bsd disklabel
c
toggle the dos compatibility flag
d
delete a partition
l
list known partition types
m
print this menu
n
add a new partition
o
create a new empty DOS partition table
p
print the partition table
q
quit without saving changes
s
create a new empty Sun disklabel
t
change a partition's system id
u
change display/entry units
v
verify the partition table
w
write table to disk and exit
x
extra functionality (experts only)
Command (m for help): d
Partition number (1-4): 1
Command (m for help): d
Selected partition 2
Command (m for help): 2
2: unknown command
Command action
a
toggle a bootable flag
b
edit bsd disklabel
c
toggle the dos compatibility flag
d
delete a partition
l
list known partition types
m
print this menu
n
add a new partition
o
create a new empty DOS partition table
p
print the partition table
q
quit without saving changes
s
create a new empty Sun disklabel
t
change a partition's system id
u
change display/entry units
v
verify the partition table
w
write table to disk and exit
x
extra functionality (experts only)
Command (m for help): p
Disk /dev/xvdb: 20.9 GB, 20971520000 bytes
255 heads, 63 sectors/track, 2549 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot
Start
End
Blocks
Command (m for help): n
Command action
e
extended
p
primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2549, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2549, default 2549):
Using default value 2549
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
5.3 Konfiguracja asmlib
[root@dbaa yum.repos.d]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:
Scanning the system for Oracle ASMLib disks:
[root@dbaa yum.repos.d]#
[
[
OK
OK
]
]
Usunięcie śmieci z poprzedniego szkolenia
[root@dbaa yum.repos.d]# /etc/init.d/oracleasm listdisks
CDATA
[root@dbaa yum.repos.d]# /etc/init.d/oracleasm deletedisk CDATA
Removing ASM disk "CDATA":
[ OK
[root@dbaa yum.repos.d]# /etc/init.d/oracleasm listdisks
]
Tworzenie dysku ASMLIB
[root@dbaa yum.repos.d]# /etc/init.d/oracleasm createdisk data /dev/xvdb1
Marking disk "data" as an ASM disk:
[ OK ]
[root@dbaa yum.repos.d]# ls -l /dev/oracleasm/disks/
total 0
brw-rw---- 1 oracle dba 202, 17 Jan 25 12:50 DATA
[root@dbaa yum.repos.d]# ls -l /dev/xvdb1
brw-r----- 1 root disk 202, 17 Jan 25 12:50 /dev/xvdb1
[root@dbaa yum.repos.d]#
5.4 Instalacja grid
Zainstalować grida z opcją na pojedynczy serwer (standalone)
5.5 Konfiguracja ASM
5.5.1 Środowisko
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid
export ORACLE_SID=+ASM
export PATH=$PATH:$ORACLE_HOME/bin
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias dgmgrl='rlwrap dgmgrl'
5.5.2 Podłączenie do instancji asm
[oracle@dbaa ~]$ sqlplus "/as sysasm"
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jan 25 13:51:07 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option
SQL>
5.5.3 Stan diskgrup, dusków
Opis np.: http://www.oracle-base.com/articles/10g/AutomaticStorageManagement10g.php
SQL> select NAME from v$asm_diskgroup;
NAME
-----------------------------DATA
SQL> column PATH format A30
SQL> select NAME, PATH from v$asm_disk;
NAME
PATH
------------------------------ -----------------------------DATA
ORCL:DATA
SQL> select name, usable_file_mb from v$asm_diskgroup;
NAME
USABLE_FILE_MB
------------------------------ -------------DATA
19935
SQL>
5.5.4 Administrowanie
[oracle@dbaa ~]$ sqlplus "/as sysasm"
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jan 25 14:05:14 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option
SQL>
[oracle@dbaa ~]$ asmcmd
ASMCMD> lsdg
State
Type
Rebal Sector Block
Offline_disks Voting_files Name
MOUNTED EXTERN N
512
4096
0
N DATA/
ASMCMD> exit
AU
Total_MB
Free_MB
Req_mir_free_MB
Usable_file_MB
1048576
19994
19935
0
19935
[oracle@dbaa ~]$ srvctl status asm
ASM is running on dbaa
[oracle@dbaa ~]$ srvctl status diskgroup -g data
Disk Group data is running on dbaa
[oracle@dbaa ~]$
6 Migrowanie bazy do ASM
Wymagania najkrótszej przerwy w działaniu.
6.1 Tworzenie nowej instancji nowy spfile z instniejącego
Sid stary orcl
Sid nosy orclasm
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Wed Jan 25 14:09:35 2012
Copyright (c) 1982, 2010, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_SID=orcl
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
SQL> create pfile from spfile;
File created.
SQL>
[oracle@dbaa dbs]$ cat initorcl.ora
orcl.__db_cache_size=738197504
orcl.__java_pool_size=16777216
orcl.__large_pool_size=16777216
orcl.__pga_aggregate_target=218103808
orcl.__sga_target=1073741824
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=285212672
orcl.__streams_pool_size=0
*.compatible='11.2.0'
*.control_files='/u01/oradata/control01.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/oradata'
*.db_create_online_log_dest_1='/u01/oradata'
*.db_name='orcl'
*.db_recovery_file_dest='/u01/flash_recovery_area'
*.db_recovery_file_dest_size=4294967296
*.db_securefile='PERMITTED'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)'
*.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523))'
*.open_cursors=300
*.pga_aggregate_target=209715200
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_max_size=2147483648
*.sga_target=1073741824
*.shared_servers=5
*.undo_tablespace='UNDO1'
Zmienić nazwę pliku i konfigurację w pliku
[oracle@dbaa dbs]$ more initorclasm.ora
*.compatible='11.2.0'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+DATA'
*.db_name='orcl'
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=4294967296
*.db_securefile='PERMITTED'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)'
*.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523))'
*.open_cursors=300
*.pga_aggregate_target=209715200
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_max_size=2147483648
*.sga_target=1073741824
*.shared_servers=5
*.undo_tablespace='UNDO1'
instance_name='orclasm'
Utworzenie spfile
[oracle@dbaa dbs]$ ORACLE_SID=orclasm
[oracle@dbaa dbs]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Wed Jan 25 14:16:28 2012
Copyright (c) 1982, 2010, Oracle.
All rights reserved.
Connected to an idle instance.
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
SQL> create spfile from pfile;
File created.
SQL>
6.2 Odtworzenie controlfile
6.2.1 Start bazy orclasm nomount
[oracle@dbaa dbs]$
[oracle@dbaa dbs]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Wed Jan 25 14:26:49 2012
Copyright (c) 1982, 2010, Oracle.
All rights reserved.
Connected to an idle instance.
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
SQL> startup nomount
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2228200 bytes
Variable Size
1375731736 bytes
Database Buffers
754974720 bytes
Redo Buffers
4952064 bytes
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
6.2.2 restore controlfile
[oracle@dbaa dbs]$ rman target /
Recovery Manager: Release 11.2.0.2.0 - Production on Wed Jan 25 14:27:38 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.
All rights reserved.
connected to target database: ORCL (not mounted)
RMAN> restore controlfile from
'/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/control_2012.01.25_14.00.01.1kn1le95_1_1';
Starting restore at 25-JAN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
output file name=+DATA/orcl/controlfile/current.256.773504897
Finished restore at 25-JAN-12
6.2.3 Sprawdzenie czy controlfile jest odtworzony na asm
[oracle@dbaa ~]$ . .asm
[oracle@dbaa ~]$ asmcmd
ASMCMD> ls
DATA/
ASMCMD> cd DATA
ASMCMD> ls
ASM/
ORCL/
ASMCMD> cd ORCL
ASMCMD> ls
CONTROLFILE/
ASMCMD> cd CONTROLFILE
ASMCMD> ls
current.256.773504897
ASMCMD>
6.2.4 Sprawdzenie czy rman zmienił konfiguracje lokalizacji controlfile w
spfile
SQL> show parameter control
NAME
-----------------------------------control_file_record_keep_time
control_files
TYPE
----------integer
string
control_management_pack_access
string
VALUE
-----------------------------7
+DATA/orcl/controlfile/current
.256.773504897
DIAGNOSTIC+TUNING
6.2.5 Montowanie bazy
SQL>
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01102: cannot mount database in EXCLUSIVE mode
Instancja montując bazę próbuje utworzyć plik loka lkORCL w $ORACLE_HOME/dbs
nazwa na podstawie spfile. Należy zmienić db_unique_name
SQL> alter system set db_unique_name=orclasm scope=spfile;
System altered.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2228200 bytes
Variable Size
1375731736 bytes
Database Buffers
754974720 bytes
Redo Buffers
4952064 bytes
SQL> alter database mount;
Database altered.
SQL>
SQL> show parameters name
NAME
-----------------------------------db_file_name_convert
db_name
db_unique_name
global_names
instance_name
lock_name_space
log_file_name_convert
service_names
TYPE
----------string
string
string
boolean
string
string
string
string
VALUE
-----------------------------orcl
ORCLASM
FALSE
orclasm
ORCLASM
6.2.6 Restore bazy do ASM
[oracle@dbaa dbs]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Wed Jan 25 14:59:54 2012
Copyright (c) 1982, 2010, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
SQL> select 'set newname for datafile ' || file# || ' to ''+DATA'';' from v$datafile;
'SETNEWNAMEFORDATAFILE'||FILE#||'TO''+DATA'';'
----------------------------------------------------------------------------set newname for datafile 1 to '+DATA';
set newname for datafile 2 to '+DATA';
set newname for datafile 3 to '+DATA';
set newname for datafile 4 to '+DATA';
set newname for datafile 5 to '+DATA';
set newname for datafile 7 to '+DATA';
6 rows selected.
SQL>
RMAN> run {
set newname for datafile 1 to
set newname for datafile 2 to
set newname for datafile 3 to
set newname for datafile 4 to
set newname for datafile 5 to
7> set newname for datafile 7
8> restore database;
9> switch datafile all;
10> }
'+DATA';
'+DATA';
'+DATA';
'+DATA';
'+DATA';
to '+DATA';
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 25-JAN-12
Starting implicit crosscheck backup at 25-JAN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=137 device type=DISK
Crosschecked 46 objects
Finished implicit crosscheck backup at 25-JAN-12
Starting implicit crosscheck copy at 25-JAN-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 25-JAN-12
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to +DATA
channel ORA_DISK_1: restoring datafile 00004 to +DATA
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv0_2012.01.25_11.29.30.0nn1l5cs_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv0_2012.01.25_11.29.30.0nn1l5cs_1_1
tag=TAG20120125T112931
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to +DATA
channel ORA_DISK_1: restoring datafile 00005 to +DATA
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv0_2012.01.25_11.29.30.0mn1l5cs_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv0_2012.01.25_11.29.30.0mn1l5cs_1_1
tag=TAG20120125T112931
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA
channel ORA_DISK_1: restoring datafile 00007 to +DATA
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv0_2012.01.25_11.29.30.0ln1l5cs_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv0_2012.01.25_11.29.30.0ln1l5cs_1_1
tag=TAG20120125T112931
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 25-JAN-12
datafile 1 switched
input datafile copy
datafile 2 switched
input datafile copy
datafile 3 switched
input datafile copy
datafile 4 switched
input datafile copy
datafile 5 switched
input datafile copy
datafile 7 switched
input datafile copy
to datafile copy
RECID=13 STAMP=773507094
to datafile copy
RECID=14 STAMP=773507094
to datafile copy
RECID=15 STAMP=773507094
to datafile copy
RECID=16 STAMP=773507094
to datafile copy
RECID=17 STAMP=773507094
to datafile copy
RECID=18 STAMP=773507094
file name=+DATA/orclasm/datafile/system.261.773507069
file name=+DATA/orclasm/datafile/sysaux.259.773507061
file name=+DATA/orclasm/datafile/undo1.257.773507055
file name=+DATA/orclasm/datafile/undo2.258.773507055
file name=+DATA/orclasm/datafile/users.260.773507061
file name=+DATA/orclasm/datafile/def_tbs.262.773507069
RMAN>
RMAN> report schema
2> ;
RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name ORCLASM
List of Permanent Datafiles
===========================
File Size(MB) Tablespace
---- -------- -------------------1
380
SYSTEM
2
200
SYSAUX
3
180
UNDO1
RB segs
------***
***
***
Datafile Name
-----------------------+DATA/orclasm/datafile/system.261.773507069
+DATA/orclasm/datafile/sysaux.259.773507061
+DATA/orclasm/datafile/undo1.257.773507055
4
5
7
100
100
100
UNDO2
USERS
DEF_TBS
***
***
***
+DATA/orclasm/datafile/undo2.258.773507055
+DATA/orclasm/datafile/users.260.773507061
+DATA/orclasm/datafile/def_tbs.262.773507069
List of Temporary Files
=======================
File Size(MB) Tablespace
Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- -------------------1
20
TEMP
20
/u01/oradata/ORCL/datafile/o1_mf_temp_7kxf4l87_.tmp
RMAN>
Gdyby nie było switch datafile all to trzeba ręcznie wydać
switch database to copy;
6.2.7 recover database
RMAN> recover database;
Starting recover at 25-JAN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: +DATA/orclasm/datafile/system.261.773507069
destination for restore of datafile 00007: +DATA/orclasm/datafile/def_tbs.262.773507069
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_11.45.36.0un1l6b2_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_11.45.36.0un1l6b2_1_1
tag=TAG20120125T114538
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00002: +DATA/orclasm/datafile/sysaux.259.773507061
destination for restore of datafile 00005: +DATA/orclasm/datafile/users.260.773507061
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_11.45.36.0vn1l6b2_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_11.45.36.0vn1l6b2_1_1
tag=TAG20120125T114538
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00003: +DATA/orclasm/datafile/undo1.257.773507055
destination for restore of datafile 00004: +DATA/orclasm/datafile/undo2.258.773507055
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_11.45.36.10n1l6b2_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_11.45.36.10n1l6b2_1_1
tag=TAG20120125T114538
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00002: +DATA/orclasm/datafile/sysaux.259.773507061
destination for restore of datafile 00005: +DATA/orclasm/datafile/users.260.773507061
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_12.00.00.17n1l762_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_12.00.00.17n1l762_1_1
tag=TAG20120125T120001
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00003: +DATA/orclasm/datafile/undo1.257.773507055
destination for restore of datafile 00004: +DATA/orclasm/datafile/undo2.258.773507055
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_12.00.00.18n1l762_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_12.00.00.18n1l762_1_1
tag=TAG20120125T120001
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: +DATA/orclasm/datafile/system.261.773507069
destination for restore of datafile 00007: +DATA/orclasm/datafile/def_tbs.262.773507069
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_12.00.00.16n1l762_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_12.00.00.16n1l762_1_1
tag=TAG20120125T120001
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00003: +DATA/orclasm/datafile/undo1.257.773507055
destination for restore of datafile 00004: +DATA/orclasm/datafile/undo2.258.773507055
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_14.00.01.1gn1le7d_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_14.00.01.1gn1le7d_1_1
tag=TAG20120125T140011
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00002: +DATA/orclasm/datafile/sysaux.259.773507061
destination for restore of datafile 00005: +DATA/orclasm/datafile/users.260.773507061
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_14.00.01.1fn1le7d_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_14.00.01.1fn1le7d_1_1
tag=TAG20120125T140011
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: +DATA/orclasm/datafile/system.261.773507069
destination for restore of datafile 00007: +DATA/orclasm/datafile/def_tbs.262.773507069
channel ORA_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_14.00.01.1en1le7c_1_1
channel ORA_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.25/data_lv1_2012.01.25_14.00.01.1en1le7c_1_1
tag=TAG20120125T140011
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
starting media recovery
archived log for thread 1 with sequence 10 is already on disk as file
/u01/oradata/ORCL/onlinelog/o1_mf_1_7kxf4d8x_.log
archived log for thread 1 with sequence 11 is already on disk as file
/u01/oradata/ORCL/onlinelog/o1_mf_2_7kxf4f6d_.log
archived log file name=/u01/oradata/ORCL/onlinelog/o1_mf_1_7kxf4d8x_.log thread=1 sequence=10
archived log file name=/u01/oradata/ORCL/onlinelog/o1_mf_2_7kxf4f6d_.log thread=1 sequence=11
media recovery complete, elapsed time: 00:00:00
Finished recover at 25-JAN-12
RMAN>
Switch logów na instancji orcl
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system checkpoint;
System altered.
SQL>
Zamknąć instancję orcl
SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
RMAN> recover database;
Starting recover at 25-JAN-12
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 11 is already on disk as file
/u01/oradata/ORCL/onlinelog/o1_mf_2_7kxf4f6d_.log
archived log for thread 1 with sequence 12 is already on disk as file
/u01/oradata/ORCL/onlinelog/o1_mf_3_7kxf4g1y_.log
archived log for thread 1 with sequence 13 is already on disk as file
/u01/oradata/ORCL/onlinelog/o1_mf_1_7kxf4d8x_.log
archived log file name=/u01/oradata/ORCL/onlinelog/o1_mf_2_7kxf4f6d_.log thread=1 sequence=11
archived log file name=/u01/oradata/ORCL/onlinelog/o1_mf_3_7kxf4g1y_.log thread=1 sequence=12
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/25/2012 15:17:30
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile
'/u01/oradata/ORCL/onlinelog/o1_mf_3_7kxf4g1y_.log'
ORA-00283: recovery session canceled due to errors
ORA-00600: internal error code, arguments: [3680], [], [], [], [], [], [], [], [], [], [], []
RMAN> alter database open resetlogs;
database opened
RMAN>
6.2.8 Rekreowanie grup redo.
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
SQL> select member from v$logfile;
MEMBER
-------------------------------------------------------------------------------/u01/oradata/ORCL/onlinelog/o1_mf_1_7kxf4d8x_.log
/u01/oradata/ORCL/onlinelog/o1_mf_2_7kxf4f6d_.log
/u01/oradata/ORCL/onlinelog/o1_mf_3_7kxf4g1y_.log
SQL> alter database add logfile group 4 size 100m, group 5 size 100m, group 6 size 100m;
Database altered.
SQL> alter database drop logfile group 1, group 2, group 3;
alter database drop logfile group 1, group 2, group 3
*
ERROR at line 1:
ORA-01623: log 1 is current log for instance orclasm (thread 1) - cannot drop
ORA-00312: online log 1 thread 1:
'/u01/oradata/ORCL/onlinelog/o1_mf_1_7kxf4d8x_.log'
SQL> alter system switch logfile;
System altered.
SQL> alter system checkpoint;
System altered.
SQL> alter database drop logfile group 1, group 2, group 3;
alter database drop logfile group 1, group 2, group 3
*
ERROR at line 1:
ORA-01623: log 2 is current log for instance orclasm (thread 1) - cannot drop
ORA-00312: online log 2 thread 1:
'/u01/oradata/ORCL/onlinelog/o1_mf_2_7kxf4f6d_.log'
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system checkpoint;
System altered.
SQL> alter database drop logfile group 1, group 2, group 3;
alter database drop logfile group 1, group 2, group 3
*
ERROR at line 1:
ORA-00359: logfile group 1 does not exist
SQL> alter database drop logfile
group 2, group 3;
Database altered.
SQL>
6.2.9 temp tablespace
SQL> alter tablespace temp add tempfile size 100m;
Tablespace altered.
SQL> alter database tempfile 1 drop;
Database altered.
SQL>
6.2.10
Backup przygotowanym skryptme
./mk_backup.sh 0
6.3 Rejestracja bazy w grid
Niezgodność bazy danych z wersją grida
7 Patchowanie bazy danych
7.1 Instalacja 11.2.0.3
Zainstalować 11.2.0.3 w innej lokalizacji.
7.2 Pre upgrade script utlu112i.sql
[oracle@dbaa
[oracle@dbaa
[oracle@dbaa
utlu112i.sql
utlu112s.sql
[oracle@dbaa
[oracle@dbaa
[oracle@dbaa
11.2.0]$ cd dbhome_2
dbhome_2]$ cd rdbms/admin/
admin]$ cp utlu
utlu112x.sql utlurl.sql
utluiobj.sql utlusts.sql
admin]$ cp utlu112i.sql /tmp/
admin]$ cd /tmp/
tmp]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Thu Jan 26 10:45:34 2012
Copyright (c) 1982, 2010, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
SQL> @utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 01-26-2012 10:46:03
Script Version: 11.2.0.3.0 Build: 001
.
**********************************************************************
Database:
**********************************************************************
--> name:
ORCL
--> version:
11.2.0.2.0
--> compatible:
11.2.0
--> blocksize:
8192
--> platform:
Linux x86 64-bit
--> timezone file: V14
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 390 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 207 MB
--> UNDO1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit database.
**********************************************************************
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.
--> If Target Oracle is 64-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No obsolete parameters found. No changes are required
.
**********************************************************************
Components: [The following database components will be upgraded or installed]
**********************************************************************
--> Oracle Catalog Views
[upgrade] VALID
--> Oracle Packages and Types
[upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java
[upgrade] VALID
--> Real Application Clusters
[upgrade] VALID
--> Oracle XML Database
[upgrade] VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Database contains INVALID objects prior to upgrade.
.... The list of invalid SYS/SYSTEM objects was written to
.... registry$sys_inv_objs.
.... The list of non-SYS/SYSTEM objects was written to
.... registry$nonsys_inv_objs.
.... Use utluiobj.sql after the upgrade to identify any new invalid
.... objects due to the upgrade.
.... USER HR has 1 INVALID objects.
.... USER PUBLIC has 5 INVALID objects.
.... USER SYS has 22 INVALID objects.
WARNING: --> Your recycle bin is turned on and currently contains no objects.
.... Because it is REQUIRED that the recycle bin be empty prior to upgrading
.... and your recycle bin is turned on, you may need to execute the command:
PURGE DBA_RECYCLEBIN
.... prior to executing your upgrade to confirm the recycle bin is empty.
.
**********************************************************************
Recommendations
**********************************************************************
Oracle recommends gathering dictionary statistics prior to
upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;
**********************************************************************
Oracle recommends reviewing any defined events prior to upgrading.
To view existing non-default events execute the following commands
while connected AS SYSDBA:
Events:
SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2
WHERE UPPER(name) ='EVENT' AND isdefault='FALSE'
Trace Events:
SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2
WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'
Changes will need to be made in the init.ora or spfile.
**********************************************************************
SQL>
7.3 Rekompilacja obiektów utlrp.sql
SQL> @?/rdbms/admin/utlrp
TIMESTAMP
-------------------------------------------------------------------------------COMP_TIMESTAMP UTLRP_BGN 2012-01-26 10:48:53
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>#
The following PL/SQL block invokes UTL_RECOMP to recompile invalid
objects in the database. Recompilation time is proportional to the
number of invalid objects in the database, so this command may take
a long time to execute on a database with a large number of invalid
objects.
Use the following queries to track recompilation progress:
1. Query returning the number of invalid objects remaining. This
number should decrease with time.
SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
2. Query returning the number of objects compiled so far. This number
should increase with time.
SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
This script automatically chooses serial or parallel recompilation
based on the number of CPUs available (parameter cpu_count) multiplied
by the number of threads per CPU (parameter parallel_threads_per_cpu).
On RAC, this number is added across all RAC nodes.
UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
recompilation. Jobs are created without instance affinity so that they
can migrate across RAC nodes. Use the following queries to verify
whether UTL_RECOMP jobs are being created and run correctly:
1. Query showing jobs created by UTL_RECOMP
SELECT job_name FROM dba_scheduler_jobs
WHERE job_name like 'UTL_RECOMP_SLAVE_%';
2. Query showing UTL_RECOMP jobs that are running
SELECT job_name FROM dba_scheduler_running_jobs
WHERE job_name like 'UTL_RECOMP_SLAVE_%';
PL/SQL procedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END
2012-01-26 10:49:52
DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
------------------0
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
--------------------------0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
SQL>
SQL> select count(*) from dba_objects where status <> 'VALID';
COUNT(*)
---------0
7.4 Upgrade
7.4.1 Shutdown immediate
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
7.4.2 Przeniesienie plików konfiguracyjnych
[oracle@dbaa dbhome_1]$ cd ../dbhome_2/dbs/
[oracle@dbaa dbs]$ cp $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora .
7.4.3 Ustawienie nowego ORACLE_HOME
export ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
export ORACLE_SID=orclasm
export PATH=$PATH:$ORACLE_HOME/bin
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias dgmgrl='rlwrap dgmgrl'
7.4.4 Startup upgrade
[oracle@dbaa ~]$ . .11g
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 26 11:02:07 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to an idle instance.
SQL> startup upgrade
ORACLE instance started.
Total System Global Area 2137886720
Fixed Size
2230072
Variable Size
1409288392
Database Buffers
721420288
Redo Buffers
4947968
Database mounted.
Database opened.
SQL>spool /home/oracle/upgrade.lst
bytes
bytes
bytes
bytes
bytes
SQL>@?/rdbms/admin/catupgrd
SQL> REM bug 12337546 - Exit current sqlplus session at end of catupgrd.sql.
SQL> REM
This forces user to start a new sqlplus session in order
SQL> REM
to connect to the upgraded db.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@dbaa ~]$
7.4.5 Start bazy rekompilacja obiektów
[oracle@dbaa ~]$
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 26 11:31:56 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1476397256 bytes
Database Buffers
654311424 bytes
Redo Buffers
4947968 bytes
Database mounted.
Database opened.
SQL> select count(*) from dba_objects where status <> 'VALID';
COUNT(*)
---------4068
SQL> @?/rdbms/admin/utlrp
TIMESTAMP
-------------------------------------------------------------------------------COMP_TIMESTAMP UTLRP_BGN 2012-01-26 11:33:23
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>
DOC>#
The following PL/SQL block invokes UTL_RECOMP to recompile invalid
objects in the database. Recompilation time is proportional to the
number of invalid objects in the database, so this command may take
a long time to execute on a database with a large number of invalid
objects.
Use the following queries to track recompilation progress:
1. Query returning the number of invalid objects remaining. This
number should decrease with time.
SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
2. Query returning the number of objects compiled so far. This number
should increase with time.
SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
This script automatically chooses serial or parallel recompilation
based on the number of CPUs available (parameter cpu_count) multiplied
by the number of threads per CPU (parameter parallel_threads_per_cpu).
On RAC, this number is added across all RAC nodes.
UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
recompilation. Jobs are created without instance affinity so that they
can migrate across RAC nodes. Use the following queries to verify
whether UTL_RECOMP jobs are being created and run correctly:
1. Query showing jobs created by UTL_RECOMP
SELECT job_name FROM dba_scheduler_jobs
WHERE job_name like 'UTL_RECOMP_SLAVE_%';
2. Query showing UTL_RECOMP jobs that are running
SELECT job_name FROM dba_scheduler_running_jobs
WHERE job_name like 'UTL_RECOMP_SLAVE_%';
PL/SQL procedure successfully completed.
TIMESTAMP
-------------------------------------------------------------------------------COMP_TIMESTAMP UTLRP_END 2012-01-26 11:35:47
DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
------------------0
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
--------------------------0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
SQL>
7.4.6 Listener
Zabić ze starego ORACLE_HOME
[oracle@dbaa ~]$ ps -ef |grep tnsl
oracle
6657
1 0 Jan24 ?
00:00:00
/u01/app/oracle/database/product/11.2.0/dbhome_1/bin/tnslsnr LISTENER -inherit
oracle
16177
1 0 Jan25 ?
00:00:00 /u01/app/oracle/product/11.2.0/grid/bin/tnslsnr
LISTENER -inherit
oracle
28476 28108 0 11:37 pts/3
00:00:00 grep tnsl
[oracle@dbaa ~]$ kill -9 6657
7.4.7 Rejestracja nowej bazy w grid
Home bazy danych
Usunięcie nieprawidłowo zdefiniowanej baz w clustrze
[oracle@dbaa ~]$ srvctl remove database -d oracleasm
Remove the database oracleasm? (y/[n]) y
Rejestracja
[oracle@dbaa ~]$ srvctl add database -d orclasm -o $ORACLE_HOME -p
$ORACLE_HOME/dbs/spfileoracleasm.ora -n orclasm -i orclasm -a data
[oracle@dbaa ~]$
[oracle@dbaa ~]$
Status
[oracle@dbaa ~]$ srvctl status database -d oracleasm
PRCD-1120 : The resource for database oracleasm could not be found.
PRCR-1001 : Resource ora.oracleasm.db does not exist
[oracle@dbaa ~]$ srvctl status database -d orclasm
Database is not running.
[oracle@dbaa ~]$
stop bazy z sqlplus
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 26 11:45:19 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Start z clustra
[oracle@dbaa ~]$ srvctl start database -d orclasm
[oracle@dbaa ~]$ srvctl status database -d orclasm
Database is running.
[oracle@dbaa ~]$
status bazy w clustrze
Ustawiony home grida
[oracle@dbaa ~]$ crsctl status resource -t
-------------------------------------------------------------------------------NAME
TARGET STATE
SERVER
STATE_DETAILS
-------------------------------------------------------------------------------Local Resources
-------------------------------------------------------------------------------ora.DATA.dg
ONLINE ONLINE
dbaa
ora.LISTENER.lsnr
ONLINE
ONLINE
dbaa
ONLINE
dbaa
ora.asm
ONLINE
Started
ora.ons
OFFLINE OFFLINE
dbaa
-------------------------------------------------------------------------------Cluster Resources
-------------------------------------------------------------------------------ora.cssd
1
ONLINE ONLINE
dbaa
ora.diskmon
1
OFFLINE OFFLINE
ora.evmd
1
ONLINE
ONLINE
dbaa
ora.orclasm.db
1
ONLINE
ONLINE
dbaa
Open
[oracle@dbaa ~]$ crsctl status resource -t
-------------------------------------------------------------------------------NAME
TARGET STATE
SERVER
STATE_DETAILS
-------------------------------------------------------------------------------Local Resources
-------------------------------------------------------------------------------ora.DATA.dg
ONLINE ONLINE
dbaa
ora.LISTENER.lsnr
ONLINE ONLINE
dbaa
ora.asm
ONLINE ONLINE
dbaa
Started
ora.ons
OFFLINE OFFLINE
dbaa
-------------------------------------------------------------------------------Cluster Resources
-------------------------------------------------------------------------------ora.cssd
1
ONLINE ONLINE
dbaa
ora.diskmon
1
OFFLINE OFFLINE
ora.evmd
1
ONLINE ONLINE
dbaa
ora.orclasm.db
1
ONLINE ONLINE
dbaa
Open
[oracle@dbaa ~]$
Usunięcie starego ORACLE_HOME
7.4.8 Dodanie tnslsnr do bazy z grida
Z ORACLE_HOME grid
[oracle@dbaa ~]$ srvctl add listener -l LISTENERDB -p "TCP:1523" -o
/u01/app/oracle/product/11.2.0/grid
[oracle@dbaa ~]$
[oracle@dbaa ~]$
[oracle@dbaa ~]$
[oracle@dbaa ~]$ srvctl start listener -l LISTENERDB
[oracle@dbaa ~]$
[oracle@dbaa ~]$
[oracle@dbaa ~]$ lsnrctl status LISTENERDB
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 26-JAN-2012 12:07:10
Copyright (c) 1991, 2011, Oracle.
All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENERDB)))
STATUS of the LISTENER
-----------------------Alias
LISTENERDB
Version
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date
26-JAN-2012 12:06:56
Uptime
0 days 0 hr. 0 min. 15 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File
/u01/app/oracle/product/11.2.0/grid/log/diag/tnslsnr/dbaa/listenerdb/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENERDB)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1523)))
The listener supports no services
The command completed successfully
Słucha na localhost
zmienić w /etc/hosts
[root@dbaa 11.2.0]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1
localhost.localdomain localhost
::1
localhost6.localdomain6 localhost6
10.8.8.113
dbaa.localdomain dbaa
[root@dbaa 11.2.0]# su - oracle
[oracle@dbaa ~]$ . .asm
[oracle@dbaa ~]$ srvctl stop listener
PRCC-1016 : LISTENER was already stopped
PRCR-1005 : Resource ora.LISTENER.lsnr is already stopped
PRCC-1016 : LISTENERDB was already stopped
PRCR-1005 : Resource ora.LISTENERDB.lsnr is already stopped
[oracle@dbaa
[oracle@dbaa
[oracle@dbaa
[oracle@dbaa
~]$ srvctl start listener
~]$
~]$
~]$ lsnrctl status LISTENERDB
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 26-JAN-2012 12:13:54
Copyright (c) 1991, 2011, Oracle.
All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENERDB)))
STATUS of the LISTENER
-----------------------Alias
LISTENERDB
Version
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date
26-JAN-2012 12:13:35
Uptime
0 days 0 hr. 0 min. 18 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File
/u01/app/oracle/product/11.2.0/grid/log/diag/tnslsnr/dbaa/listenerdb/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENERDB)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.8.8.113)(PORT=1523)))
The listener supports no services
The command completed successfully
7.4.9 Dodanie protokołu ftp do bazy
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 26 12:30:16 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> exec dbms_xdb.setftpport(2020);
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
SQL> alter user xdb identified by oracle account unlock;
User altered.
SQL>
[oracle@dbaa ~]$ lsnrctl status LISTENERDB
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 26-JAN-2012 12:31:59
Copyright (c) 1991, 2011, Oracle.
All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENERDB)))
STATUS of the LISTENER
-----------------------Alias
LISTENERDB
Version
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date
26-JAN-2012 12:13:35
Uptime
0 days 0 hr. 18 min. 23 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
Listener Log File
/u01/app/oracle/product/11.2.0/grid/log/diag/tnslsnr/dbaa/listenerdb/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENERDB)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.8.8.113)(PORT=1523)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbaa.localdomain)(PORT=8080))(Presentation=HTTP)(Session=R
AW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbaa.localdomain)(PORT=2020))(Presentation=FTP)(Session=RA
W))
Services Summary...
Service "orclXDB" has 1 instance(s).
Instance "orclasm", status READY, has 1 handler(s) for this service...
Service "orclasm" has 1 instance(s).
Instance "orclasm", status READY, has 1 handler(s) for this service...
The command completed successfully
7.4.10
Dostęp ftp
ftp> [oracle@dbaa ~]$ ftp dbaa.localdomain 2020
Connected to dbaa.localdomain.
220- dbaa.localdomain
Unauthorised use of this FTP server is prohibited and
prosecution.
220 dbaa.localdomain FTP Server (Oracle XML DB/Oracle
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (dbaa.localdomain:oracle): xdb
331 pass required for XDB
Password:
230 XDB logged in
Remote system type is Unix.
ftp> ls
227 Entering Passive Mode (10,8,8,113,224,111)
150 ASCII Data Connection
drw-r--r-2 SYS
oracle
0 JAN 12 11:15
drw-r--r-2 SYS
oracle
0 JAN 12 11:18
-rw-r--r-1 SYS
oracle
0 JAN 26 12:30
226 ASCII Transfer Complete
ftp> cd public
250 CWD Command successful
ftp> ls
227 Entering Passive Mode (10,8,8,113,238,68)
150 ASCII Data Connection
226 ASCII Transfer Complete
ftp> cd ../sys
250 CWD Command successful
may be subject to civil and criminal
Database) ready.
public
sys
xdbconfig.xml
ftp> ls
227 Entering Passive Mode (10,8,8,113,164,152)
150 ASCII Data Connection
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
drw-r--r-2 SYS
oracle
0 JAN 12
226 ASCII Transfer Complete
ftp> cd log
250 CWD Command successful
ftp> ls
227 Entering Passive Mode (10,8,8,113,8,4)
150 ASCII Data Connection
226 ASCII Transfer Complete
ftp>
11:16
11:15
11:18
11:16
11:15
11:16
11:16
11:15
11:16
11:15
11:19
acloids
acls
apps
asm
log
oid
principals
schemas
version
workspaces
xs
8 Clon bazy danych.
8.1 Backup
8.2 Create spfile
[oracle@dbaa dbs]$ mv initorclasm.ora inittest.ora
[oracle@dbaa dbs]$ vi inittest.ora
[oracle@dbaa dbs]$ cat inittest.ora
*.compatible='11.2.0'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+DATA'
*.db_name='test'
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=4294967296
*.db_securefile='PERMITTED'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)'
*.instance_name='test'
*.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523))'
*.open_cursors=300
*.pga_aggregate_target=209715200
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_max_size=2147483648
*.sga_target=1073741824
*.shared_servers=5
*.undo_tablespace='UNDO1'
[oracle@dbaa dbs]$
[oracle@dbaa dbs]$
[oracle@dbaa dbs]$ pwd
/u01/app/oracle/database/product/11.2.0/dbhome_2/dbs
[oracle@dbaa dbs]$ cd
[oracle@dbaa ~]$ . .test
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 26 13:35:05 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
SQL>
8.3 Plik haseł
[oracle@dbaa
[oracle@dbaa
[oracle@dbaa
[oracle@dbaa
dbs]$ orapwd file=orapworclasm password=oracle
dbs]$
dbs]$
dbs]$ sqlplus sys/oracle@10.8.8.113:1523/orclasm as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 26 13:44:04 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL>
8.4 Duplikacja
8.4.1 Duplikacja z backupu
[oracle@dbaa dbs]$ rman target sys/oracle@10.8.8.113:1523/orclasm auxiliary /
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Jan 26 13:53:36 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates.
All rights reserved.
connected to target database: ORCL (DBID=1294297143)
connected to auxiliary database: TEST (not mounted)
RMAN> duplicate target database to 'test';
Starting Duplicate Db at 26-JAN-12
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=134 device type=DISK
contents of Memory Script:
{
sql clone "alter system set control_files =
''+DATA/test/controlfile/current.280.773589377'' comment=
''Set by RMAN'' scope=spfile";
sql clone "alter system set db_name =
''ORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''TEST'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set control_files =
comment= ''Set by RMAN'' scope=spfile
sql statement: alter system set
scope=spfile
db_name =
sql statement: alter system set
scope=spfile
db_unique_name =
''+DATA/test/controlfile/current.280.773589377''
''ORCL'' comment= ''Modified by RMAN duplicate''
''TEST'' comment= ''Modified by RMAN duplicate''
Oracle instance shut down
Oracle instance started
Total System Global Area
2137886720 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers
2230072
1375733960
754974720
4947968
bytes
bytes
bytes
bytes
Starting restore at 26-JAN-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=137 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/control_2012.01.26_12.46.54.4un1nuff_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/control_2012.01.26_12.46.54.4un1nuff_1_1
tag=TAG20120126T124951
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
output file name=+DATA/test/controlfile/current.280.773589377
Finished restore at 26-JAN-12
database mounted
contents of Memory Script:
{
set until scn 1511085;
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
restore
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
1
2
3
4
5
7
to
to
to
to
to
to
new;
new;
new;
new;
new;
new;
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 26-JAN-12
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_12.46.54.4mn1nua1_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_12.46.54.4mn1nua1_1_1
tag=TAG20120126T124657
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_12.46.54.4nn1nua2_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_12.46.54.4nn1nua2_1_1
tag=TAG20120126T124657
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00007 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_12.46.54.4ln1nua1_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_12.46.54.4ln1nua1_1_1
tag=TAG20120126T124657
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 26-JAN-12
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched
input datafile copy
datafile 2 switched
input datafile copy
datafile 3 switched
input datafile copy
datafile 4 switched
input datafile copy
datafile 5 switched
input datafile copy
datafile 7 switched
input datafile copy
to datafile copy
RECID=49 STAMP=773589438
to datafile copy
RECID=50 STAMP=773589438
to datafile copy
RECID=51 STAMP=773589438
to datafile copy
RECID=52 STAMP=773589438
to datafile copy
RECID=53 STAMP=773589438
to datafile copy
RECID=54 STAMP=773589439
contents of Memory Script:
{
set until scn 1511085;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 26-JAN-12
using channel ORA_AUX_DISK_1
file name=+DATA/test/datafile/system.275.773589411
file name=+DATA/test/datafile/sysaux.277.773589405
file name=+DATA/test/datafile/undo1.279.773589397
file name=+DATA/test/datafile/undo2.276.773589405
file name=+DATA/test/datafile/users.278.773589397
file name=+DATA/test/datafile/def_tbs.274.773589411
starting media recovery
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=29
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/arch_2012.01.26_12.46.54.4tn1nuco_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/arch_2012.01.26_12.46.54.4tn1nuco_1_1
tag=TAG20120126T124800
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
archived log file name=+DATA/test/archivelog/2012_01_26/thread_1_seq_29.264.773589441 thread=1
sequence=29
channel clone_default: deleting archived log(s)
archived log file name=+DATA/test/archivelog/2012_01_26/thread_1_seq_29.264.773589441 RECID=96
STAMP=773589447
media recovery complete, elapsed time: 00:00:00
Finished recover at 26-JAN-12
Oracle instance started
Total System Global Area
2137886720 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers
2230072
1375733960
754974720
4947968
bytes
bytes
bytes
bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''TEST'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set
scope=spfile
db_name =
sql statement: alter system reset
''TEST'' comment= ''Reset to original value by RMAN''
db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area
2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TEST" RESETLOGS ARCHIVELOG
MAXLOGFILES
64
MAXLOGMEMBERS
5
MAXDATAFILES
30
MAXINSTANCES
32
MAXLOGHISTORY
10225
LOGFILE
GROUP
4 SIZE 100 M ,
GROUP
5 SIZE 100 M ,
GROUP
6 SIZE 100 M
DATAFILE
'+DATA/test/datafile/system.275.773589411'
CHARACTER SET UTF8
contents of Memory Script:
{
set newname for clone tempfile 2 to new;
switch clone tempfile all;
catalog clone datafilecopy "+DATA/test/datafile/sysaux.277.773589405",
"+DATA/test/datafile/undo1.279.773589397",
"+DATA/test/datafile/undo2.276.773589405",
"+DATA/test/datafile/users.278.773589397",
"+DATA/test/datafile/def_tbs.274.773589411";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 2 to +DATA in control file
cataloged datafile
datafile copy file
cataloged datafile
datafile copy file
cataloged datafile
datafile copy file
cataloged datafile
datafile copy file
cataloged datafile
datafile copy file
copy
name=+DATA/test/datafile/sysaux.277.773589405 RECID=1 STAMP=773589466
copy
name=+DATA/test/datafile/undo1.279.773589397 RECID=2 STAMP=773589466
copy
name=+DATA/test/datafile/undo2.276.773589405 RECID=3 STAMP=773589466
copy
name=+DATA/test/datafile/users.278.773589397 RECID=4 STAMP=773589466
copy
name=+DATA/test/datafile/def_tbs.274.773589411 RECID=5 STAMP=773589466
datafile 2 switched
input datafile copy
datafile 3 switched
input datafile copy
datafile 4 switched
input datafile copy
datafile 5 switched
input datafile copy
datafile 7 switched
input datafile copy
to datafile copy
RECID=1 STAMP=773589466
to datafile copy
RECID=2 STAMP=773589466
to datafile copy
RECID=3 STAMP=773589466
to datafile copy
RECID=4 STAMP=773589466
to datafile copy
RECID=5 STAMP=773589466
file name=+DATA/test/datafile/sysaux.277.773589405
file name=+DATA/test/datafile/undo1.279.773589397
file name=+DATA/test/datafile/undo2.276.773589405
file name=+DATA/test/datafile/users.278.773589397
file name=+DATA/test/datafile/def_tbs.274.773589411
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 26-JAN-12
8.5 Duplikacja z aktywnej bazy do test2
8.5.1 Konfiguracja spfile
[oracle@dbaa
[oracle@dbaa
[oracle@dbaa
[oracle@dbaa
~]$ cd $ORACLE_HOME/dbs
dbs]$ cp inittest.ora inittest2.ora
dbs]$ vi inittest2.ora
dbs]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 26 14:03:14 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
SQL> create spfile from pfile;
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
SQL>
8.5.2 Rejestracja statyczna test2 w listener
[oracle@dbaa admin]$ cat listener.ora
LISTENERDB=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENERDB))))
line added by Agent
# listener.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=test2)
(ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dbaa.localdomain)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENERDB=ON
# line added by Agent
# line added by Agent
plik haseł
[oracle@dbaa ~]$ orapwd file=orapwtest2 password=oracle
8.5.3 Duplikacja (from active database)
[oracle@dbaa dbs]$ rman target sys/oracle@10.8.8.113:1523/orclasm auxiliary
sys/oracle@10.8.8.113:1521/test2
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Jan 26 14:25:57 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates.
All rights reserved.
connected to target database: ORCL (DBID=1294297143)
connected to auxiliary database: TEST2 (not mounted)
RMAN> duplicate target database to test2 from active database;
Starting Duplicate Db at 26-JAN-12
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=134 device type=DISK
contents of Memory Script:
{
sql clone "alter system set control_files =
''+DATA/test2/controlfile/current.270.773591163'' comment=
''Set by RMAN'' scope=spfile";
sql clone "alter system set db_name =
''ORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''TEST2'' comment=
''Modified by RMAN duplicate'' scope=spfile";
#
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format
'+DATA/test2/controlfile/current.271.773591163';
sql clone "alter system set control_files =
''+DATA/test2/controlfile/current.271.773591163'' comment=
''Set by RMAN'' scope=spfile";
shutdown clone immediate;
startup clone nomount;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set control_files =
comment= ''Set by RMAN'' scope=spfile
sql statement: alter system set
scope=spfile
db_name =
sql statement: alter system set
scope=spfile
db_unique_name =
''+DATA/test2/controlfile/current.270.773591163''
''ORCL'' comment= ''Modified by RMAN duplicate''
''TEST2'' comment= ''Modified by RMAN duplicate''
Oracle instance shut down
Oracle instance started
Total System Global Area
2137886720 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers
2230072
1375733960
754974720
4947968
bytes
bytes
bytes
bytes
Starting backup at 26-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/oracle/database/product/11.2.0/dbhome_2/dbs/snapcf_orclasm.f
tag=TAG20120126T142612 RECID=43 STAMP=773591174
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 26-JAN-12
sql statement: alter system set control_files =
comment= ''Set by RMAN'' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area
2137886720 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers
2230072
1375733960
754974720
4947968
bytes
bytes
bytes
bytes
database mounted
contents of Memory Script:
{
set newname for clone datafile 1 to new;
set newname for clone datafile 2 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 4 to new;
set newname for clone datafile 5 to new;
set newname for clone datafile 7 to new;
backup as copy reuse
datafile 1 auxiliary format new
datafile 2 auxiliary format new
datafile 3 auxiliary format new
datafile 4 auxiliary format new
datafile 5 auxiliary format new
datafile 7 auxiliary format new
;
sql 'alter system archive log current';
}
executing Memory Script
''+DATA/test2/controlfile/current.271.773591163''
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 26-JAN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/orclasm/datafile/system.261.773507069
output file name=+DATA/test2/datafile/system.273.773591193 tag=TAG20120126T142631
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/orclasm/datafile/undo1.257.773507055
output file name=+DATA/test2/datafile/undo1.281.773591207 tag=TAG20120126T142631
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/orclasm/datafile/sysaux.259.773507061
output file name=+DATA/test2/datafile/sysaux.282.773591223 tag=TAG20120126T142631
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/orclasm/datafile/undo2.258.773507055
output file name=+DATA/test2/datafile/undo2.283.773591229 tag=TAG20120126T142631
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/orclasm/datafile/users.260.773507061
output file name=+DATA/test2/datafile/users.284.773591233 tag=TAG20120126T142631
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00007 name=+DATA/orclasm/datafile/def_tbs.262.773507069
output file name=+DATA/test2/datafile/def_tbs.285.773591235 tag=TAG20120126T142631
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 26-JAN-12
sql statement: alter system archive log current
contents of Memory Script:
{
backup as copy reuse
archivelog like "+DATA/orclasm/archivelog/2012_01_26/thread_1_seq_32.286.773591239" auxiliary
format
"+DATA"
;
catalog clone start with "+DATA";
switch clone datafile all;
}
executing Memory Script
Starting backup at 26-JAN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=32 RECID=98 STAMP=773591239
output file name=+DATA/test2/archivelog/2012_01_26/thread_1_seq_32.287.773591239 RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 26-JAN-12
searching for all files that match the pattern +DATA
List of Files Unknown to the Database
=====================================
File Name: +data/TEST2/ARCHIVELOG/2012_01_26/thread_1_seq_32.287.773591239
File Name: +data/TEST2/DATAFILE/SYSTEM.273.773591193
File Name: +data/TEST2/DATAFILE/UNDO1.281.773591207
File Name: +data/TEST2/DATAFILE/SYSAUX.282.773591223
File Name: +data/TEST2/DATAFILE/UNDO2.283.773591229
File Name: +data/TEST2/DATAFILE/USERS.284.773591233
File Name: +data/TEST2/DATAFILE/DEF_TBS.285.773591235
File Name: +data/TEST2/CONTROLFILE/Current.270.773591163
File Name: +data/TEST/TEMPFILE/TEMP.263.773589473
File Name: +data/TEST/ONLINELOG/group_4.264.773589467
File Name: +data/TEST/ONLINELOG/group_5.265.773589469
File Name: +data/TEST/ONLINELOG/group_6.269.773589469
File Name: +data/TEST/DATAFILE/UNDO1.279.773589397
File Name: +data/TEST/DATAFILE/USERS.278.773589397
File Name: +data/TEST/DATAFILE/SYSAUX.277.773589405
File Name:
File Name:
File Name:
File Name:
File Name:
File Name:
File Name:
cataloging
cataloging
+data/TEST/DATAFILE/UNDO2.276.773589405
+data/TEST/DATAFILE/SYSTEM.275.773589411
+data/TEST/DATAFILE/DEF_TBS.274.773589411
+data/TEST/CONTROLFILE/Current.280.773589377
+data/ORCLASM/ARCHIVELOG/2012_01_26/thread_1_seq_32.286.773591239
+data/ORCL/CONTROLFILE/current.256.773504897
+data/ASM/ASMPARAMETERFILE/REGISTRY.253.773502105
files...
done
List of Cataloged Files
=======================
File Name: +data/TEST2/ARCHIVELOG/2012_01_26/thread_1_seq_32.287.773591239
File Name: +data/TEST2/DATAFILE/SYSTEM.273.773591193
File Name: +data/TEST2/DATAFILE/UNDO1.281.773591207
File Name: +data/TEST2/DATAFILE/SYSAUX.282.773591223
File Name: +data/TEST2/DATAFILE/UNDO2.283.773591229
File Name: +data/TEST2/DATAFILE/USERS.284.773591233
File Name: +data/TEST2/DATAFILE/DEF_TBS.285.773591235
File Name: +data/ORCLASM/ARCHIVELOG/2012_01_26/thread_1_seq_32.286.773591239
List of Files Which Where Not Cataloged
=======================================
File Name: +data/TEST2/CONTROLFILE/Current.270.773591163
RMAN-07517: Reason: The file header is corrupted
File Name: +data/TEST/TEMPFILE/TEMP.263.773589473
RMAN-07518: Reason: Foreign database file DBID: 2071735897
File Name: +data/TEST/ONLINELOG/group_4.264.773589467
RMAN-07518: Reason: Foreign database file DBID: 2071735897
File Name: +data/TEST/ONLINELOG/group_5.265.773589469
RMAN-07518: Reason: Foreign database file DBID: 2071735897
File Name: +data/TEST/ONLINELOG/group_6.269.773589469
RMAN-07518: Reason: Foreign database file DBID: 2071735897
File Name: +data/TEST/DATAFILE/UNDO1.279.773589397
RMAN-07519: Reason: Error while cataloging. See alert.log.
File Name: +data/TEST/DATAFILE/USERS.278.773589397
RMAN-07519: Reason: Error while cataloging. See alert.log.
File Name: +data/TEST/DATAFILE/SYSAUX.277.773589405
RMAN-07519: Reason: Error while cataloging. See alert.log.
File Name: +data/TEST/DATAFILE/UNDO2.276.773589405
RMAN-07519: Reason: Error while cataloging. See alert.log.
File Name: +data/TEST/DATAFILE/SYSTEM.275.773589411
RMAN-07519: Reason: Error while cataloging. See alert.log.
File Name: +data/TEST/DATAFILE/DEF_TBS.274.773589411
RMAN-07519: Reason: Error while cataloging. See alert.log.
File Name: +data/TEST/CONTROLFILE/Current.280.773589377
RMAN-07518: Reason: Foreign database file DBID: 2071735897
File Name: +data/ORCL/CONTROLFILE/current.256.773504897
RMAN-07519: Reason: Error while cataloging. See alert.log.
File Name: +data/ASM/ASMPARAMETERFILE/REGISTRY.253.773502105
RMAN-07518: Reason: Foreign database file DBID: 0 Database
datafile 1 switched
input datafile copy
datafile 2 switched
input datafile copy
datafile 3 switched
input datafile copy
datafile 4 switched
input datafile copy
datafile 5 switched
input datafile copy
datafile 7 switched
input datafile copy
to datafile copy
RECID=49 STAMP=773591241
to datafile copy
RECID=50 STAMP=773591241
to datafile copy
RECID=51 STAMP=773591241
to datafile copy
RECID=52 STAMP=773591241
to datafile copy
RECID=53 STAMP=773591241
to datafile copy
RECID=54 STAMP=773591241
Database Name: TEST
Database Name: TEST
Database Name: TEST
Database Name: TEST
Database Name: TEST
Name:
file name=+DATA/test2/datafile/system.273.773591193
file name=+DATA/test2/datafile/sysaux.282.773591223
file name=+DATA/test2/datafile/undo1.281.773591207
file name=+DATA/test2/datafile/undo2.283.773591229
file name=+DATA/test2/datafile/users.284.773591233
file name=+DATA/test2/datafile/def_tbs.285.773591235
contents of Memory Script:
{
set until scn 1514706;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 26-JAN-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=136 device type=DISK
starting media recovery
archived log for thread 1 with sequence 32 is already on disk as file
+DATA/test2/archivelog/2012_01_26/thread_1_seq_32.287.773591239
archived log file name=+DATA/test2/archivelog/2012_01_26/thread_1_seq_32.287.773591239 thread=1
sequence=32
media recovery complete, elapsed time: 00:00:00
Finished recover at 26-JAN-12
Oracle instance started
Total System Global Area
2137886720 bytes
Fixed Size
Variable Size
Database Buffers
Redo Buffers
2230072
1375733960
754974720
4947968
bytes
bytes
bytes
bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''TEST2'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set
scope=spfile
db_name =
sql statement: alter system reset
''TEST2'' comment= ''Reset to original value by RMAN''
db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area
2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TEST2" RESETLOGS ARCHIVELOG
MAXLOGFILES
64
MAXLOGMEMBERS
5
MAXDATAFILES
30
MAXINSTANCES
32
MAXLOGHISTORY
10225
LOGFILE
GROUP
4 SIZE 100 M ,
GROUP
5 SIZE 100 M ,
GROUP
6 SIZE 100 M
DATAFILE
'+DATA/test2/datafile/system.273.773591193'
CHARACTER SET UTF8
contents of Memory Script:
{
set newname for clone tempfile 2 to new;
switch clone tempfile all;
catalog clone datafilecopy "+DATA/test2/datafile/sysaux.282.773591223",
"+DATA/test2/datafile/undo1.281.773591207",
"+DATA/test2/datafile/undo2.283.773591229",
"+DATA/test2/datafile/users.284.773591233",
"+DATA/test2/datafile/def_tbs.285.773591235";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 2 to +DATA in control file
cataloged datafile copy
datafile copy file name=+DATA/test2/datafile/sysaux.282.773591223 RECID=1 STAMP=773591260
cataloged datafile copy
datafile copy file
cataloged datafile
datafile copy file
cataloged datafile
datafile copy file
cataloged datafile
datafile copy file
name=+DATA/test2/datafile/undo1.281.773591207 RECID=2 STAMP=773591260
copy
name=+DATA/test2/datafile/undo2.283.773591229 RECID=3 STAMP=773591260
copy
name=+DATA/test2/datafile/users.284.773591233 RECID=4 STAMP=773591260
copy
name=+DATA/test2/datafile/def_tbs.285.773591235 RECID=5 STAMP=773591260
datafile 2 switched
input datafile copy
datafile 3 switched
input datafile copy
datafile 4 switched
input datafile copy
datafile 5 switched
input datafile copy
datafile 7 switched
input datafile copy
to datafile copy
RECID=1 STAMP=773591260
to datafile copy
RECID=2 STAMP=773591260
to datafile copy
RECID=3 STAMP=773591260
to datafile copy
RECID=4 STAMP=773591260
to datafile copy
RECID=5 STAMP=773591260
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 26-JAN-12
file name=+DATA/test2/datafile/sysaux.282.773591223
file name=+DATA/test2/datafile/undo1.281.773591207
file name=+DATA/test2/datafile/undo2.283.773591229
file name=+DATA/test2/datafile/users.284.773591233
file name=+DATA/test2/datafile/def_tbs.285.773591235
9 Uruchomienie bazy w trybie niespójnym
9.1 Symulacja awarii (shutdown immediate).
9.1.1 Zatrzymać bazę
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 26 15:16:20 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=test
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL>
9.1.2 Usunąć asmcmd redologi
[root@dbaa ~]# su - oracle
[oracle@dbaa ~]$ . .asm
[oracle@dbaa ~]$ asmcmd
ASMCMD> ls
DATA/
ASMCMD> cd DATA
ASMCMD> ls
ASM/
ORCL/
ORCLASM/
TEST/
TEST2/
ASMCMD> cd TEST
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
TEMPFILE/
ASMCMD> cd ONLINELOG/
ASMCMD> ls
group_4.264.773589467
group_5.265.773589469
group_6.269.773589469
ASMCMD> rm *
You may delete multiple files and/or directories.
Are you sure? (y/n) y
ASMCMD> ls -l
ASMCMD-8002: entry 'ONLINELOG' does not exist in directory '+DATA/TEST/'
ASMCMD> quit
[oracle@dbaa ~]$
9.1.3 Start
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 26 15:30:17 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to an idle instance.
ORACLE_SID=test
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> sutdown abort;
SP2-0734: unknown command beginning "sutdown ab..." - rest of line ignored.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> show sga
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> startup mount force;
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
Database mounted.
SQL> recover until cancel
Media recovery complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL>
Baza została podniesiona pomimo usunięcia redologów ponieważ zamknięcie było spójne.
9.2 Baza nie spójnie zamknięta
9.2.1 Zatrzymanie bazy (shutdown abort)
SQL> startup
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
Database mounted.
ORA-00313: open failed for members of log group 4 of thread 1
ORA-00312: online log 4 thread 1: '+DATA/test/onlinelog/group_4.269.773595091'
ORA-17503: ksfdopn:2 Failed to open file
+DATA/test/onlinelog/group_4.269.773595091
ORA-15012: ASM file '+DATA/test/onlinelog/group_4.269.773595091' does not exist
SQL> recover until cancel
ORA-00279: change 1515922 generated at 01/26/2012 15:31:36 needed for thread 1
ORA-00289: suggestion : +DATA
ORA-15173: entry 'ARCHIVELOG' does not exist in directory 'TEST'
ORA-00280: change 1515922 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log '+DATA'
ORA-17503: ksfdopn:2 Failed to open file +DATA
ORA-15045: ASM file name '+DATA' is not in reference form
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '+DATA/test/datafile/system.275.773589411'
Baza nie może się podneść ponieważ nie ma logów
9.2.2 Ustawienie _allow_resetlogs_corruption
SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;
System altered.
SQL> startup mount force;
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
Database mounted.
SQL> recover until cancel;
ORA-00279: change 1515922 generated at 01/26/2012 15:31:36 needed for thread 1
ORA-00289: suggestion : +DATA
ORA-15173: entry 'ARCHIVELOG' does not exist in directory 'TEST'
ORA-00280: change 1515922 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log '+DATA'
ORA-17503: ksfdopn:2 Failed to open file +DATA
ORA-15045: ASM file name '+DATA' is not in reference form
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '+DATA/test/datafile/system.275.773589411'
SQL> alter database open resetlogs;
Database altered.
SQL>
10 Odtwarzanie tablespace do punktu w czasie
( Przepisać ze zrzutu Kamila)
Dzień IV
11 DataGuard
11.1 dg_broker
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 10:13:21 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> show parameters brok
NAME
TYPE
VALUE
------------------------------------ ----------- -----------------------------dg_broker_config_file1
string
/u01/app/oracle/database/produ
ct/11.2.0/dbhome_2/dbs/dr1ORCL
ASM.dat
dg_broker_config_file2
string
/u01/app/oracle/database/produ
ct/11.2.0/dbhome_2/dbs/dr2ORCL
ASM.dat
dg_broker_start
boolean
FALSE
SQL> alter system set dg_broker_start=true;
System altered.
11.2 Force loging
SQL> alter database force logging;
Database altered.
SQL>
11.3 Nowa baza st
[oracle@dbaa dbs]$ more inittest.ora
*.compatible='11.2.0'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+DATA'
*.db_name='test'
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=4294967296
*.db_securefile='PERMITTED'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)'
*.instance_name='test'
*.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523))'
*.open_cursors=300
*.pga_aggregate_target=209715200
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_max_size=2147483648
*.sga_target=1073741824
*.shared_servers=5
*.undo_tablespace='UNDO1'
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 10:32:23 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to an idle instance.
ORACLE_SID=st
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> create spfile from pfile;
File created.
SQL>
Rejestracja w listener asm-a
[oracle@dbaa admin]$ cat listener.ora
LISTENERDB=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENERDB))))# line added by
Agent
# listener.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=st)
(ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2)
)
(SID_DESC=
(SID_NAME=orclasm)
(ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dbaa.localdomain)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENERDB=ON
# line added by Agent
# line added by Agent
tnsnames bazy danych
orclasm =
(DESCRIPTION =
(ADDRESS = ( PROTOCOL = TCP)(HOST = DBAA)(PORT=1521))
(CONNECT_DATA = (SID=orclasm)
)
)
st =
(DESCRIPTION =
(ADDRESS = ( PROTOCOL = TCP)(HOST = DBAA)(PORT=1521))
(CONNECT_DATA = (SID=st)
)
)
11.4 Plik haseł
[oracle@dbaa dbs]$ orapwd file=orapwst password=oracle
11.5 Test połączenia poprzez nazwy tnsnamed.ora
[oracle@dbaa admin]$ tnsping st
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 27-JAN-2012 10:47:52
Copyright (c) 1997, 2011, Oracle.
All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = ( PROTOCOL = TCP)(HOST = DBAA)(PORT=1521))
(CONNECT_DATA = (SID=st)))
OK (30 msec)
[oracle@dbaa admin]$ tnsping orclasm
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 27-JAN-2012 10:47:57
Copyright (c) 1997, 2011, Oracle.
All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = ( PROTOCOL = TCP)(HOST = DBAA)(PORT=1521))
(CONNECT_DATA = (SID=orclasm)))
OK (10 msec)
[oracle@dbaa admin]$ sqlplus sys/oracle@st as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 10:48:07 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to an idle instance.
ORACLE_SID=st
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> Disconnected
[oracle@dbaa admin]$ sqlplus sys/oracle@orclasm as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 10:48:16 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=st
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
11.6 Duplikacja (for standby)
[oracle@dbaa ~]$ rman target sys/oracle@orclasm auxiliary sys/oracle@st
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jan 27 11:01:33 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates.
All rights reserved.
connected to target database: ORCL (DBID=1294297143)
connected to auxiliary database: ORCL (not mounted)
RMAN> duplicate target database for standby;
Starting Duplicate Db at 27-JAN-12
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=10 device type=DISK
contents of Memory Script:
{
sql clone "alter system set control_files =
''+DATA/st/controlfile/current.293.773665299'' comment=
''Set by RMAN'' scope=spfile";
restore clone standby controlfile;
}
executing Memory Script
sql statement: alter system set control_files =
comment= ''Set by RMAN'' scope=spfile
''+DATA/st/controlfile/current.293.773665299''
Starting restore at 27-JAN-12
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.27/control_2012.01.27_10.00.00.b8n1q906_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.27/control_2012.01.27_10.00.00.b8n1q906_1_1
tag=TAG20120127T100142
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA/st/controlfile/current.286.773665301
Finished restore at 27-JAN-12
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for clone
switch clone tempfile
set newname for clone
set newname for clone
set newname for clone
set newname for clone
set newname for clone
set newname for clone
restore
clone database
;
tempfile
all;
datafile
datafile
datafile
datafile
datafile
datafile
2 to new;
1
2
3
4
5
7
to
to
to
to
to
to
new;
new;
new;
new;
new;
new;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 2 to +DATA in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 27-JAN-12
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00007 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_17.00.00.6cn1od4k_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_17.00.00.6cn1od4k_1_1
tag=TAG20120126T170003
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_17.00.00.6en1od4l_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_17.00.00.6en1od4l_1_1
tag=TAG20120126T170003
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_17.00.00.6dn1od4k_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_17.00.00.6dn1od4k_1_1
tag=TAG20120126T170003
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece
/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_17.00.00.6fn1od4o_1_1
channel ORA_AUX_DISK_1: piece
handle=/u01/app/oracle/backup/dbaa.localdomain/2012.01.26/data_lv0_2012.01.26_17.00.00.6fn1od4o_1_1
tag=TAG20120126T170003
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 27-JAN-12
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=50 STAMP=773665350
datafile 2 switched to datafile copy
input datafile copy RECID=51 STAMP=773665350
datafile 3 switched to datafile copy
input datafile copy RECID=52 STAMP=773665350
datafile 4 switched to datafile copy
input datafile copy RECID=53 STAMP=773665350
datafile 5 switched to datafile copy
input datafile copy RECID=54 STAMP=773665350
datafile 7 switched to datafile copy
input datafile copy RECID=55 STAMP=773665350
Finished Duplicate Db at 27-JAN-12
file name=+DATA/st/datafile/system.292.773665307
file name=+DATA/st/datafile/sysaux.297.773665343
file name=+DATA/st/datafile/undo1.296.773665335
file name=+DATA/st/datafile/undo2.298.773665343
file name=+DATA/st/datafile/users.295.773665333
file name=+DATA/st/datafile/def_tbs.294.773665307
RMAN>
11.7 Dodanie redo standby login
Logi muszą być identyczne lub większe niż na primary.
11.7.1
Primary
[oracle@dbaa ~]$ . .11g
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 11:25:48 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> alter database add standby logfile group 11 size 100m, group 12 size 100m, group 13 size 100m;
Database altered.
SQL>
11.7.2
Secondary
[oracle@dbaa ~]$ . .st
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 11:27:42 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=st
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> alter database add standby logfile group 11 size 100m, group 12 size 100m, group 13 size 100m;
Database altered.
SQL>
11.8 Konfiguracja Data Guard (dgmgrl)
11.8.1
Primary
[oracle@dbaa ~]$ dgmgrl sys/oracle@orclasm
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> create configuration prod_standby as primary database is orclasm connect identifier is
orclasm;
Configuration "prod_standby" created with primary database "orclasm"
DGMGRL> show configuration;
Configuration - prod_standby
Protection Mode: MaxPerformance
Databases:
orclasm - Primary database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
DGMGRL>
11.8.2
Secondary
Błąd
[oracle@dbaa ~]$ dgmgrl sys/oracle@orclasm
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> add database st as connect identifier is st maintained as physical;
Error: ORA-01017: invalid username/password; logon denied
skopiować plik haseł z primary na secondary
[oracle@dbaa ~]$ dgmgrl sys/oracle@orclasm
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> add database st as connect identifier IS st maintained as physical;
Database "st" added
DGMGRL> DGMGRL>
11.9 Włączanie konfiguracji.
[oracle@dbaa ~]$ dgmgrl sys/oracle@orclasm
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration;
Configuration - prod_standby
Protection Mode: MaxPerformance
Databases:
orclasm - Primary database
st
- Physical standby database
Error: ORA-16664: unable to receive the result from a database
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
Bład z powodu dwóch listenerów ( dodanie konfiguracji remote_listener)
SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1521))'
scope=both;
System altered.
SQL> alter system register;
status bazy danych w
DGMGRL>
DGMGRL>
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration;
Configuration - prod_standby
Protection Mode: MaxPerformance
Databases:
orclasm - Primary database
Error: ORA-16724: cannot resolve gap for one or more standby databases
st
- Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
DGMGRL>
DGMGRL> show database verbose orclasm;
Database - orclasm
Role:
Intended State:
Instance(s):
orclasm
PRIMARY
TRANSPORT-ON
Database Error(s):
ORA-16783: cannot resolve gap for database st
Properties:
DGConnectIdentifier
= 'orclasm'
ObserverConnectIdentifier
= ''
LogXptMode
= 'ASYNC'
DelayMins
= '0'
Binding
= 'optional'
MaxFailure
= '0'
MaxConnections
= '1'
ReopenSecs
= '300'
NetTimeout
= '30'
RedoCompression
= 'DISABLE'
LogShipping
= 'ON'
PreferredApplyInstance
= ''
ApplyInstanceTimeout
= '0'
ApplyParallel
= 'AUTO'
StandbyFileManagement
= 'MANUAL'
ArchiveLagTarget
= '0'
LogArchiveMaxProcesses
= '4'
LogArchiveMinSucceedDest
= '1'
DbFileNameConvert
= ''
LogFileNameConvert
= ''
FastStartFailoverTarget
= ''
InconsistentProperties
= '(monitor)'
InconsistentLogXptProps
= '(monitor)'
SendQEntries
= '(monitor)'
LogXptStatus
= '(monitor)'
RecvQEntries
= '(monitor)'
SidName
= 'orclasm'
StaticConnectIdentifier
=
'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=ORCLAS
M_DGMGRL)(INSTANCE_NAME=orclasm)(SERVER=DEDICATED)))'
StandbyArchiveLocation
= 'USE_DB_RECOVERY_FILE_DEST'
AlternateLocation
= ''
LogArchiveTrace
= '0'
LogArchiveFormat
= '%t_%s_%r.dbf'
TopWaitEvents
= '(monitor)'
Database Status:
ERROR
DGMGRL> show database verbose st;
Database - st
Role:
Intended State:
Transport Lag:
Apply Lag:
Real Time Query:
Instance(s):
st
PHYSICAL STANDBY
APPLY-ON
(unknown)
(unknown)
OFF
Properties:
DGConnectIdentifier
ObserverConnectIdentifier
LogXptMode
DelayMins
Binding
MaxFailure
MaxConnections
ReopenSecs
NetTimeout
RedoCompression
LogShipping
=
=
=
=
=
=
=
=
=
=
=
'st'
''
'ASYNC'
'0'
'optional'
'0'
'1'
'300'
'30'
'DISABLE'
'ON'
PreferredApplyInstance
= ''
ApplyInstanceTimeout
= '0'
ApplyParallel
= 'AUTO'
StandbyFileManagement
= 'MANUAL'
ArchiveLagTarget
= '0'
LogArchiveMaxProcesses
= '4'
LogArchiveMinSucceedDest
= '1'
DbFileNameConvert
= ''
LogFileNameConvert
= ''
FastStartFailoverTarget
= ''
InconsistentProperties
= '(monitor)'
InconsistentLogXptProps
= '(monitor)'
SendQEntries
= '(monitor)'
LogXptStatus
= '(monitor)'
RecvQEntries
= '(monitor)'
SidName
= 'st'
StaticConnectIdentifier
=
'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.8.8.113)(PORT=1523))(CONNECT_DATA=(SERVICE_NAME=st_DGM
GRL)(INSTANCE_NAME=st)(SERVER=DEDICATED)))'
StandbyArchiveLocation
= 'USE_DB_RECOVERY_FILE_DEST'
AlternateLocation
= ''
LogArchiveTrace
= '0'
LogArchiveFormat
= '%t_%s_%r.dbf'
TopWaitEvents
= '(monitor)'
Database Status:
SUCCESS
DGMGRL>
11.10recover clone database
Nie udaje się recover clone database były usuwane pliki logów podczas backupu.
Poprawienie skryptów backupu usunięci delete all input oraz level 0
11.11Ponowna duplikacja
[oracle@dbaa ~]$ . .st
[oracle@dbaa ~]$ rman target sys/oracle@orclasm auxiliary sys/oracle@st
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jan 27 12:55:03 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates.
All rights reserved.
connected to target database: ORCL (DBID=1294297143)
connected to auxiliary database: ORCL (DBID=1294297143, not open)
RMAN>
Recovery Manager complete.
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 12:55:10 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=st
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> startup force nomount;
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
- 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@dbaa ~]$ rman target sys/oracle@orclasm auxiliary sys/oracle@st
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jan 27 12:55:23 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates.
All rights reserved.
connected to target database: ORCL (DBID=1294297143)
connected to auxiliary database: ORCL (not mounted)
RMAN> duplicate target database for standby;
Starting Duplicate Db at 27-JAN-12
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=14 device type=DISK
contents of Memory Script:
{
sql clone "alter system set control_files =
''+DATA/st/controlfile/current.286.773665301'' comment=
''Set by RMAN'' scope=spfile";
restore clone standby controlfile;
}
executing Memory Script
sql statement: alter system set control_files =
''+DATA/st/controlfile/curren
t.286.773665301'' comment= ''Set by RMAN'' scope=spfile
Starting restore at 27-JAN-12
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/backup/dbaa.lo
caldomain/2012.01.27/control_2012.01.27_12.50.36.bqn1qito_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/backup/dbaa.localdomain/201
2.01.27/control_2012.01.27_12.50.36.bqn1qito_1_1 tag=TAG20120127T125104
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA/st/controlfile/current.286.773665301
Finished restore at 27-JAN-12
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for clone tempfile
switch clone tempfile all;
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
restore
clone database
;
}
executing Memory Script
2 to new;
1
2
3
4
5
7
to
to
to
to
to
to
new;
new;
new;
new;
new;
new;
executing command: SET NEWNAME
renamed tempfile 2 to +DATA in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 27-JAN-12
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/backup/dbaa.lo
caldomain/2012.01.27/data_lv0_2012.01.27_12.50.36.bjn1qit0_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/backup/dbaa.localdomain/201
2.01.27/data_lv0_2012.01.27_12.50.36.bjn1qit0_1_1 tag=TAG20120127T125039
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/backup/dbaa.lo
caldomain/2012.01.27/data_lv0_2012.01.27_12.50.36.bkn1qit0_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/backup/dbaa.localdomain/201
2.01.27/data_lv0_2012.01.27_12.50.36.bkn1qit0_1_1 tag=TAG20120127T125039
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00007 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/backup/dbaa.lo
caldomain/2012.01.27/data_lv0_2012.01.27_12.50.36.bin1qit0_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/backup/dbaa.localdomain/201
2.01.27/data_lv0_2012.01.27_12.50.36.bin1qit0_1_1 tag=TAG20120127T125039
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 27-JAN-12
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=50 STAMP=773672176
319.773672151
datafile 2 switched to datafile copy
input datafile copy RECID=51 STAMP=773672176
317.773672145
datafile 3 switched to datafile copy
input datafile copy RECID=52 STAMP=773672176
15.773672137
datafile 4 switched to datafile copy
input datafile copy RECID=53 STAMP=773672176
18.773672145
datafile 5 switched to datafile copy
input datafile copy RECID=54 STAMP=773672176
16.773672137
datafile 7 switched to datafile copy
input datafile copy RECID=55 STAMP=773672176
.320.773672151
Finished Duplicate Db at 27-JAN-12
RMAN>
file name=+DATA/st/datafile/system.
file name=+DATA/st/datafile/sysaux.
file name=+DATA/st/datafile/undo1.3
file name=+DATA/st/datafile/undo2.3
file name=+DATA/st/datafile/users.3
file name=+DATA/st/datafile/def_tbs
11.12Włączenie konfiguracji
[oracle@dbaa ~]$ dgmgrl sys/oracle@orclasm
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> disable configuration
Disabled.
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration;
Configuration - prod_standby
Protection Mode: MaxPerformance
Databases:
orclasm - Primary database
st
- Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL>
Zainstalować tmux-a
11.13Przełączenie do trybu Active standby (baza st)
[oracle@dbaa ~]$ . .st
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 13:41:47 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=st
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> select status from v$instance;
STATUS
-----------MOUNTED
SQL> alter database open;
Database altered.
11.14Switchover
Przełączenie się nie udało bo nie było statycznie zarejestrowanych serwisów dg_brokera
[oracle@dbaa ~]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> switchover to st;
Performing switchover NOW, please wait...
Error: ORA-16772: switchover to a standby database failed
Failed.
Unable to switchover, primary database is still "orclasm"
DGMGRL>
[oracle@dbaa ~]$ . .11g
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 14:17:25 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected.
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1493174472 bytes
Database Buffers
637534208 bytes
Redo Buffers
4947968 bytes
Database mounted.
Database opened.
SQL>
[oracle@dbaa ~]$ . .st
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 14:18:01 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=st
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> show sga
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
SQL>
11.15Dodatkowo zarejestrować serwis statyczny dla brokera
[oracle@dbaa admin]$ cat listener.ora
LISTENERDB=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENERDB))))
line added by Agent
# listener.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=st)
(ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2)
)
(SID_DESC=
(SID_NAME=st)
(GLOBAL_DBNAME=ST_DGB)
(ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2)
)
(SID_DESC=
(SID_NAME=orclasm)
(ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2)
)
(SID_DESC=
(SID_NAME=orclasm)
(GLOBAL_DBNAME=ORCLASM_DGB)
(ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dbaa.localdomain)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENERDB=ON
# line added by Agent
# line added by Agent
[oracle@dbaa ~]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> switchover to st;
Performing switchover NOW, please wait...
New primary database "st" is opening...
Operation requires shutdown of instance "orclasm" on database "orclasm"
Shutting down instance "orclasm"...
ORA-01031: insufficient privileges
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
shut down instance "orclasm" of database "orclasm"
start up instance "orclasm" of database "orclasm"
DGMGRL>
[oracle@dbaa ~]$ . .11g
[oracle@dbaa ~]$ sqlplus "/as sysdba"
#
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 14:28:01 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> shutdown immediate;
ORA-01092: ORACLE instance terminated. Disconnection forced
SQL> startup
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL> shutdown abort;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL> startup;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL>
SQL>
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 14:28:36 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to an idle instance.
ORACLE_SID=orclasm
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> startup;
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1493174472 bytes
Database Buffers
637534208 bytes
Redo Buffers
4947968 bytes
Database mounted.
Database opened.
SQL> create table ala ( ala int);
create table ala ( ala int)
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
SQL> drop table ala;
drop table ala
*
ERROR at line 1:
ORA-16000: database open for read-only access
SQL>
11.16switchover – st to orclasm
[oracle@dbaa ~]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> switchover to orclasm;
Performing switchover NOW, please wait...
New primary database "orclasm" is opening...
Operation requires shutdown of instance "st" on database "st"
Shutting down instance "st"...
ORA-01031: insufficient privileges
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
shut down instance "st" of database "st"
start up instance "st" of database "st"
DGMGRL> DGMGRL>
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 14:31:36 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
ORACLE_SID=st
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> shutdown immediate;
ORA-01092: ORACLE instance terminated. Disconnection forced
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@dbaa ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 27 14:31:45 2012
Copyright (c) 1982, 2011, Oracle.
All rights reserved.
Connected to an idle instance.
ORACLE_SID=st
ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_2
SQL> startup
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size
2230072 bytes
Variable Size
1375733960 bytes
Database Buffers
754974720 bytes
Redo Buffers
4947968 bytes
Database mounted.
Database opened.
SQL> create table ala ( ala int);
create table ala ( ala int)
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-16000: database open for read-only access
SQL>
12 Modelowanie SQL
select employee_id, salary
from employees
where department_id=50
model
dimension by (employee_id)
measures (salary)
rules
(
salary[for employee_id from 500 to 504 increment 1]
= avg(salary)[any]/2
)
/
SQL> /
EMPLOYEE_ID
SALARY
----------- ---------120
8000
121
8200
122
7900
123
6500
124
5800
125
3200
126
2700
127
2400
128
2200
129
3300
130
2800
EMPLOYEE_ID
SALARY
----------- ---------131
2500
132
2100
133
3300
134
2900
135
2400
136
2200
137
3600
138
3200
139
2700
140
2500
141
3500
EMPLOYEE_ID
SALARY
----------- ---------142
3100
143
2600
144
2500
180
3200
181
3100
182
2500
183
2800
184
4200
185
4100
186
3400
187
3000
EMPLOYEE_ID
SALARY
----------- ---------188
3800
189
3600
190
2900
191
2500
192
4000
193
3900
194
3200
195
2800
196
3100
197
3000
198
2600
EMPLOYEE_ID
----------199
500
501
502
SALARY
---------2600
1737.77778
1718.88889
1700.60284
503 1682.88822
504 1665.7159
50 rows selected.