Rechercher dans ce blog
lundi 11 novembre 2013
NID
====================
NID : DBID
=====================
oracle@lab-mtlunt96@MGTST (/home/oracle)$ nid target=sys
DBNEWID: Release 11.2.0.3.0 - Production on Mon Nov 11 13:42:34 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to database MGTST (DBID=1864518327)
Connected to server version 11.2.0
Control Files in database:
+RADIXQADATA/mgtst/controlfile/current.284.801243959
+RADIXQADATA/mgtst/controlfile/current.285.801243959
Change database ID of database MGTST? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1864518327 to 1894472279
Control File +RADIXQADATA/mgtst/controlfile/current.284.801243959 - modified
Control File +RADIXQADATA/mgtst/controlfile/current.285.801243959 - modified
Datafile +RADIXQADATA/mgtst/datafile/system.361.80139858 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/sysaux.360.80139860 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/undotbs1.358.80139862 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/users.282.80139862 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fq.601.81790495 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fqp1.593.81790496 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fqp2.437.81790497 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fqp3.603.81790497 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fqp4.590.81790498 - dbid changed
Datafile +RADIXQADATA/mgtst/tempfile/temp.452.80124405 - dbid changed
Control File +RADIXQADATA/mgtst/controlfile/current.284.801243959 - dbid cha nged
Control File +RADIXQADATA/mgtst/controlfile/current.285.801243959 - dbid cha nged
Instance shut down
Database ID for database MGTST changed to 1894472279.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.
oracle@lab-mtlunt96@MGTST (/home/oracle)$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Nov 11 13:43:26 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 5227814912 bytes
Fixed Size 2237488 bytes
Variable Size 3892317136 bytes
Database Buffers 1325400064 bytes
Redo Buffers 7860224 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Automatic Storage Management options
oracle@lab-mtlunt96@MGTST (/home/oracle)$ sqlplus / as sysdba
oracle@lab-mtlunt96@MGTST (/home/oracle)$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Nov 11 13:44:39 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: MGTST (DBID=1894472279)
RMAN> exit
Recovery Manager complete.
===================
nid dbid + db_name
======================
oracle@lab-mtlunt96@MGTST (/home/oracle)$ nid target=sys
DBNEWID: Release 11.2.0.3.0 - Production on Mon Nov 11 13:42:34 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to database MGTST (DBID=1864518327)
Connected to server version 11.2.0
Control Files in database:
+RADIXQADATA/mgtst/controlfile/current.284.801243959
+RADIXQADATA/mgtst/controlfile/current.285.801243959
Change database ID of database MGTST? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1864518327 to 1894472279
Control File +RADIXQADATA/mgtst/controlfile/current.284.801243959 - modified
Control File +RADIXQADATA/mgtst/controlfile/current.285.801243959 - modified
Datafile +RADIXQADATA/mgtst/datafile/system.361.80139858 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/sysaux.360.80139860 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/undotbs1.358.80139862 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/users.282.80139862 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fq.601.81790495 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fqp1.593.81790496 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fqp2.437.81790497 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fqp3.603.81790497 - dbid changed
Datafile +RADIXQADATA/mgtst/datafile/radair_fqp4.590.81790498 - dbid changed
Datafile +RADIXQADATA/mgtst/tempfile/temp.452.80124405 - dbid changed
Control File +RADIXQADATA/mgtst/controlfile/current.284.801243959 - dbid cha nged
Control File +RADIXQADATA/mgtst/controlfile/current.285.801243959 - dbid cha nged
Instance shut down
Database ID for database MGTST changed to 1894472279.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.
oracle@lab-mtlunt96@MGTST (/home/oracle)$ mmm
-ksh: mmm: not found [No such file or directory]
oracle@lab-mtlunt96@MGTST (/home/oracle)$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Nov 11 13:43:26 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 5227814912 bytes
Fixed Size 2237488 bytes
Variable Size 3892317136 bytes
Database Buffers 1325400064 bytes
Redo Buffers 7860224 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning and Automatic Storage Management options
oracle@lab-mtlunt96@MGTST (/home/oracle)$ sqlplus / as sysdba
oracle@lab-mtlunt96@MGTST (/home/oracle)$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Nov 11 13:44:39 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: MGTST (DBID=1894472279)
RMAN> exit
Recovery Manager complete.
mercredi 30 octobre 2013
RMAN RAC DATAGUARD
L’idée est de
pouvoir prendre des backups
sur n’importe quelles instances
de la configuration.
Dans notre cas on souhaite que les
backups soient pris depuis la standby.
Sur la primaire on va juste
faire delete des archives.
1 Configuration :
Rac 2 nodes
Primary : pocracm1/pocracm2
Rac 2 nodes
Standby : pocracl1/pocracl2
Voila la configuration :
Primary
|
STANDBY
|
|
Clusterware
|
11GR2 Grid infra (11.2.0.2)
|
11GR2 Grid infra (11.2.0.2)
|
Cluster Nodes
|
pocracm1,pocracm2
|
pocracl1,pocracl2
|
SCAN
|
||
SCAN listener Host/port
|
poccrs 1521
|
drpocrcs 1521
|
VIPs
|
pocracm1-vip,pocracm2-vip
|
pocracl1-vip,pocracl2-vip
|
DB_UNIQUE_NAME
|
pocrad
|
drpocrad
|
DB_NAME
|
POCRAD
|
POCRAD
|
DB Instances
|
POCRAD1,POCRAD2
|
DRPOCRAD1,DRPOCRAD2
|
DB LISTENER
|
LISTENER
|
LISTENER
|
DB Listener Host/port
|
1421
|
1421
|
DB STORAGE
|
ASM
|
ASM
|
OS
|
linux
|
Linux
|
archivelog
|
YES
|
YES
|
ASM
|
taille en Go
|
ASM
|
POCDB
|
200
|
POCDBL
|
POCOCR
|
2
|
POCOCRL
|
POCREDO
|
10
|
POCREDOL
|
POCARCH
|
40
|
POCARCH
|
2 Pre requis :
2.1 DbId :
Noter que le
dbid et db_names
sont identiques sur la primaire et la standby
.
Cette
information et cruciale
pour les restores du
controlfiles :
select DBID,NAME from
V$database ;
DBID NAME
238222078 POCRAD
En cas de
gros problems on a le
dbid dans le
catalog rman en se connectant
au catalog via
rman et avec
la commande rman :
List
db_unique_name all ;
DB Key
|
DB Name
|
DB ID
|
Database Role
|
Db_unique_name
|
4012718
|
POCRAD
|
238222078
|
PRIMARY
|
POCRAD
|
4012718
|
POCRAD
|
238222078
|
STANDBY
|
DRPOCRAD
|
2.2 Catalog RMAN :
An RMAN recovery catalog is
required so that backups taken on one database server can be restored to
another database server. It is not sufficient to use only the control file as
the RMAN repository because the primary database will have no knowledge of
backups taken on the standby database.
The accessibility of a backup
is different from its association. In a Data Guard environment, the recovery
catalog considers disk backups as accessible only to
the database with which it is associated, whereas tape backups created
on one database are accessible to all databases.
2.3 Notre catalog rman :
Serveur :
mtlunt68
Port : 1521
BD : emrep
Service name : catalog.
Toujours se connecter
de cette facon:
rman target sys/XXXXXX catalog catalog_rman/XXX@mtlunt68:1521/catalog
pas de
rman target
/ catalog
catalog_rman/XXX@mtlunt68:1521/catalog
2.4 Divers :
Les fichiers orapwd
doivent avoir le meme cksum
2.5 Tnsnames et services :
Primaire ( c’est juste
un extrait) :
STBPOCRAD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
drpoccrs.noam.transat.local)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME =
STBPOCRAD.noam.transat.local)
)
)
Et sur les stdby ( c’est juste
un extrait):
sale_rw =
(DESCRIPTION
=
(ADDRESS=(PROTOCOL=TCP)
(HOST=drpoccrs.noam.transat.local) (PORT=1521))
(ADDRESS=(PROTOCOL=TCP)
(HOST=poccrs.noam.transat.local) (PORT=1521))
(CONNECTs_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME =
sale_rw.noam.transat.local)
)
)
3 Configuration RMAN :
3.1 Db_unique_name :
Pour les
configure db_unique_name
voila les regles :
DB_UNIQUE_NAMEdb_unique_name {CLEAR | CONNECT IDENTIFIER'connect_string'} |
Specifies
the net service name for the physical standby database specified by
DB_UNIQUE_NAME. The CONNECT IDENTIFIER string must not
include the database username and password.
RMAN
must also be connected to the primary database as
TARGET. RMAN must be connected to a recovery catalog.
When
you run the
RESYNC
CATALOG FROM DB_UNIQUE_NAME command, databases
in a Data Guard environment use the net service name to connect with the db_unique_name database. For
example, assume that a standby database has the unique name standby1 and the net service name sby1. You connect RMAN as
TARGET to the primary database and execute CONFIGURE DB_UNIQUE_NAME 'standby1' CONNECT IDENTIFIER 'sby1'. Every primary and
standby database in the environment will use the net service name sby1 when it needs to make an Oracle Net connection to standby1.
Note: When the target database needs to connect to other standby or
primary databases, it connects as the
SYS user by using the
existing Data Guard authentication mechanisms.
Suppose
that you recently connected RMAN as
TARGET to the primary
database and used CONFIGURE ... FOR
DB_UNIQUE_NAME standby_new to configure backup settings for standby database standby_new. However, you have not yet connected RMAN as TARGET to standby_new. In this case, you
can execute RESYNC CATALOG FROM
DB_UNIQUE_NAME standby_new. The primary database uses the connect identifier to make an
Oracle Net connection to the standby database. When you later connect RMAN to
the standby database, RMAN pushes the configuration from the recovery catalog
to the mounted control file.
Note: If the database specified by
CONFIGURE DB_UNIQUE_NAME is not registered in the recovery
catalog, then RMAN implicitly registers it. |
3.2 Configuration RMAN:
3.2.1 Les primaires (pocracm1/pocracm2) :
A noter
sur la configuration de la primaire:
CONFIGURE
DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE DB_UNIQUE_NAME
'POCRAD' CONNECT IDENTIFIER 'sale_rw';
CONFIGURE DB_UNIQUE_NAME
'DRPOCRAD' CONNECT IDENTIFIER
'STBPOCRAD';
CONFIGURE ARCHIVELOG
DELETION POLICY TO APPLIED ON ALL STANDBY;
CONFIGURE SNAPSHOT
CONTROLFILE NAME TO '+POCDB/sncftestrac1.ora';
3.2.2 Sur les standby (pocracl1/pocracl2):
A noter
sur la configuration de la standbu
CONFIGURE DEFAULT DEVICE TYPE
TO 'SBT_TAPE';
CONFIGURE DB_UNIQUE_NAME
'POCRAD' CONNECT IDENTIFIER 'sale_rw';
CONFIGURE DB_UNIQUE_NAME
'DRPOCRAD' CONNECT IDENTIFIER
'STBPOCRAD';
CONFIGURE ARCHIVELOG
DELETION POLICY TO BACKED UP 1 TIMES TO 'SBT_TAPE';
CONFIGURE SNAPSHOT
CONTROLFILE NAME TO '+POCDBL/SNAPSHOTCTL_DRPOC.cf';
Les lignes en
rouges sont a inverser
si la primaire devient standby
et reciproquement.
3.3 Enregrsitrement de la config dans le catalog :
rman target
sys@pocrad catalog catalog_rman/xxxxx@mtlunt68:1521/catalog
Recovery Manager: Release
11.2.0.2.0 - Production on Mon Oct 1 13:32:26 2012
Copyright (c) 1982, 2009,
Oracle and/or its affiliates. All rights
reserved.
connected to target
database: POCRAD (DBID=238222078)
connected to recovery
catalog database
RMAN> register database;
database registered in
recovery catalog
starting full resync of
recovery catalog
full resync complete
4 Les backups :
Pour lancer un backup ou n importe quel commandes
RMAN :
1 - se connecter au
catalog:
rman target
sys/xxx@drpocrad catalog
catalog_rman/xxxxxx@mtlunt68:1521/catalog
2 - Sur la primaire
on se contente de supprimer
les archives
delete noprompt
archivelog all;
using target database control
file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=177
instance=POCRAD2 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=47
instance=POCRAD2 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=157
instance=POCRAD2 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=42
instance=POCRAD2 device type=DISK
RMAN-08120: WARNING: archived
log not deleted, not yet applied by standby
archived log file name=+POCARCH/pocrad/archivelog/2012_10_04/thread_1_seq_652.1658.795784355
thread=1 sequence=652
On a un Warning si le fichier n’est pas appliquer sur
la standby.
3 - sur la standby :
On prend des backups rman.
Backup database
plus archivelog all delete
input ;
A noter
que si on se connecte sur la
standby sans catalog on
voit les backups pris sur
la bd et réciproquement, il faut toujours se connecter
au catalog sinon
on a pas une vue d’ensmble.
5 Les Restores :
Pour les restore de la bd :
1 - se connecter
au catalog
2 - travailler sur une instance
uniquement :
Dans le fichier init mettre le
paramètre cluster database a False
3 - Mettre l’instance ou on restore
en nomount
4 - Dans Rman faire :
Restore controlfile
from autobackup ;
Alter database
mount ;
Restore database;
Recover database;
Alter database
open resetlogs;
6 Quelques commandes Rman utiles:
RESYNC CATALOG FROM DB_UNIQUE_NAME DRPOCRAD;
RESYNC CATALOG FROM DB_UNIQUE_NAME POCRAD;
Comparer les config :
show all for db_unique_name POCRAD;
show all for db_unique_name DRPOCRAD;
Supprimer un ancienne stdby
nomme dupli du
catalog:
unregister DB_UNIQUE_NAME DUPLI;
LIST DB_UNIQUE_NAME OF
DATABASE;
RESYNC CATALOG FROM DB_UNIQUE_NAME ALL;
Attention au crosscheck.
7 Annexe :
7.1 Config rman standby :
RMAN
configuration parameters for database with db_unique_name DRPOCRAD are:
CONFIGURE
RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
CONFIGURE
BACKUP OPTIMIZATION OFF; # default
CONFIGURE
DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE
CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE
CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE
DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE
DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE
DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE
DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE
ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE
ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE
CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS
'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
CONFIGURE
MAXSETSIZE TO UNLIMITED; # default
CONFIGURE
ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE
ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE
COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD FALSE;
CONFIGURE
DB_UNIQUE_NAME 'POCRAD' CONNECT IDENTIFIER
'sale_rw';
CONFIGURE
DB_UNIQUE_NAME 'DRPOCRAD' CONNECT IDENTIFIER
'STBPOCRAD';
CONFIGURE
ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO 'SBT_TAPE';
CONFIGURE
SNAPSHOT CONTROLFILE NAME TO '+POCDBL/SNAPSHOTCTL_DRPOC.cf';
7.2 Config rman Primaire :
CONFIGURE RETENTION POLICY TO
RECOVERY WINDOW OF 2 DAYS;
CONFIGURE BACKUP OPTIMIZATION
OFF; # default
CONFIGURE
DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE
AUTOBACKUP ON;
CONFIGURE CONTROLFILE
AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE CONTROLFILE
AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE DEVICE TYPE DISK
PARALLELISM 4 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DEVICE TYPE
SBT_TAPE PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP
COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DATAFILE BACKUP
COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP
COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE ARCHIVELOG BACKUP
COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE
'SBT_TAPE' PARMS
'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
CONFIGURE CHANNEL DEVICE TYPE
DISK FORMAT
'/datatmp/ARCH_%d_%I_%t_%s.bkp';
CONFIGURE MAXSETSIZE TO
UNLIMITED; # default
CONFIGURE ENCRYPTION FOR
DATABASE OFF; # default
CONFIGURE ENCRYPTION
ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION
ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD FALSE;
CONFIGURE DB_UNIQUE_NAME
'POCRAD' CONNECT IDENTIFIER 'sale_rw';
CONFIGURE DB_UNIQUE_NAME
'DRPOCRAD' CONNECT IDENTIFIER
'STBPOCRAD';
CONFIGURE ARCHIVELOG DELETION
POLICY TO APPLIED ON ALL STANDBY;
CONFIGURE SNAPSHOT
CONTROLFILE NAME TO '+POCDB/SNCFTESTRAC1.ORA';
CONFIGURE SNAPSHOT
CONTROLFILE NAME TO '+POCDB/sncftestrac1.ora';
Inscription à :
Articles (Atom)