Script sql : LOAD et AAS
- Détails
- Catégorie : Uncategorised
- Publié le vendredi 2 février 2018 20:20
- Écrit par Administrator
- Affichages : 45193
ACCEPT data_to_map CHAR PROMPT 'LOAD, AAS, AAS_CPU or AAS_WAIT: '
set verify off
set serveroutput on;
spool &data_to_map._map.html
DECLARE
myMax NUMBER;
myDBName VARCHAR2(16);
myTitle VARCHAR2(128);
myGraphType VARCHAR2(10);
FUNCTION DataCell ( P_Value NUMBER, P_Data_To_Map VARCHAR2 ) RETURN VARCHAR2 IS
myReturn VARCHAR2(128);
myColorHex VARCHAR2(16);
myNumCpu NUMBER;
threshold_1 NUMBER;
threshold_2 NUMBER;
threshold_3 NUMBER;
threshold_4 NUMBER; --very critical
BEGIN
SELECT value INTO myNumCpu FROM v$osstat WHERE stat_name='NUM_CPUS';
IF P_Data_To_Map = 'LOAD' THEN
threshold_4 := 2;
threshold_3 := 1;
threshold_2 := 0.5;
threshold_1 := 0.25;
ELSE
threshold_4 := 2 * myNumCpu;
threshold_3 := 1 * myNumCpu;
threshold_2 := 0.5 * myNumCpu;
threshold_1 := 0.25 * myNumCpu;
END IF;
IF P_Value >= threshold_4 THEN myColorHex := '#C00000';
ELSIF P_Value >= threshold_3 THEN myColorHex := '#FF0000';
ELSIF P_Value >= threshold_2 THEN myColorHex := '#FFC000';
ELSIF P_Value >= threshold_1 THEN myColorHex := '#FFFF00';
ELSE myColorHex := '#92D050';
END IF;
myReturn := '<TD STYLE="background-color: '|| myColorHex || '; font-family: monospace">' || P_Value || '</TD>';
RETURN myReturn;
END DataCell;
BEGIN
DBMS_OUTPUT.ENABLE(100000);
SELECT NAME INTO myDBName FROM V$DATABASE;
myGraphType := '&data_to_map';
CASE
WHEN myGraphType = 'LOAD' THEN myTitle :='LOAD (AAS/CPU_COUNT)';
WHEN myGraphType = 'AAS' THEN myTitle :='AAS (Active Average Session)';
WHEN myGraphType = 'AAS_CPU' THEN myTitle :='AAS_CPU (CPU part of AAS)';
WHEN myGraphType = 'AAS_WAIT' THEN myTitle :='AAS_WAIT (Wait part of AAS)';
ELSE DBMS_OUTPUT.PUT_LINE('!!! Houston, We Have a Problem! !!!');
END CASE;
DBMS_OUTPUT.PUT_LINE('<HTML>');
DBMS_OUTPUT.PUT_LINE('<H1>Map of '||myTitle||' for database: '||myDBName||'</H1>');
DBMS_OUTPUT.PUT_LINE('<TABLE>');
DBMS_OUTPUT.PUT_LINE('<TR>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">Date / Hour</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">00-01</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">01-02</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">02-03</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">03-04</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">04-05</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">05-06</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">06-07</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">07-08</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">08-09</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">09-10</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">10-11</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">11-12</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">12-13</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">13-14</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">14-15</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">15-16</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">16-17</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">17-18</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">18-19</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">19-20</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">20-21</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">21-22</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">22-23</TD>');
DBMS_OUTPUT.PUT_LINE('<TD STYLE="font-family: monospace; font-weight: bold; background-color:#DEDEDE">23-24</TD>');
DBMS_OUTPUT.PUT_LINE('<TR>');
FOR cur IN (
WITH t AS
(SELECT TO_CHAR(mtime,'YYYY/MM/DD') mtime,
TO_CHAR(mtime,'HH24') d,
&data_to_map AS value
FROM
(SELECT to_date(mtime,'YYYY-MM-DD HH24') mtime,
ROUND(SUM(c1),1) AAS_WAIT,
ROUND(SUM(c2),1) AAS_CPU,
ROUND(SUM(cnt),1) AAS,
ROUND(SUM(load),2) LOAD
FROM
(SELECT TO_CHAR(sample_time,'YYYY-MM-DD HH24') mtime,
DECODE(session_state,'WAITING',COUNT(*),0)/360 c1,
DECODE(session_state,'ON CPU',COUNT( *),0) /360 c2,
COUNT( *)/360 cnt,
COUNT( *)/360/cpu.core_nb load
FROM dba_hist_active_sess_history,
(--SELECT value AS core_nb FROM v$osstat WHERE stat_name='NUM_CPU_CORES' -- not like in https://laurent-leturgez.com/page/3/
SELECT value AS core_nb FROM v$osstat WHERE stat_name='NUM_CPUS'
) cpu
WHERE sample_time > sysdate - 30
GROUP BY TO_CHAR(sample_time,'YYYY-MM-DD HH24'),
session_state,
cpu.core_nb
)
GROUP BY mtime
)
)
SELECT mtime,
NVL("00-01_ ",0) "00-01_ ",
NVL("01-02_ ",0) "01-02_ ",
NVL("02-03_ ",0) "02-03_ ",
NVL("03-04_ ",0) "03-04_ ",
NVL("04-05_ ",0) "04-05_ ",
NVL("05-06_ ",0) "05-06_ ",
NVL("06-07_ ",0) "06-07_ ",
NVL("07-08_ ",0) "07-08_ ",
NVL("08-09_ ",0) "08-09_ ",
NVL("09-10_ ",0) "09-10_ ",
NVL("10-11_ ",0) "10-11_ ",
NVL("11-12_ ",0) "11-12_ ",
NVL("12-13_ ",0) "12-13_ ",
NVL("13-14_ ",0) "13-14_ ",
NVL("14-15_ ",0) "14-15_ ",
NVL("15-16_ ",0) "15-16_ ",
NVL("16-17_ ",0) "16-17_ ",
NVL("17-18_ ",0) "17-18_ ",
NVL("18-19_ ",0) "18-19_ ",
NVL("19-20_ ",0) "19-20_ ",
NVL("20-21_ ",0) "20-21_ ",
NVL("21-22_ ",0) "21-22_ ",
NVL("22-23_ ",0) "22-23_ ",
NVL("23-24_ ",0) "23-24_ "
FROM t pivot( SUM(value) AS " " FOR d IN ('00' AS "00-01",'01' AS "01-02",'02' AS "02-03",'03' AS "03-04",'04' AS "04-05",'05' AS "05-06",'06' AS "06-07",'07' AS "07-08",
'08' AS "08-09",'09' AS "09-10",'10' AS "10-11", '11' AS "11-12",'12' AS "12-13",'13' AS "13-14",'14' AS "14-15",'15' AS "15-16",
'16' AS "16-17",'17' AS "17-18",'18' AS "18-19",'19' AS "19-20",'20' AS "20-21",'21' AS "21-22", '22' AS "22-23",'23' AS "23-24")
)
ORDER BY mtime
)
LOOP
DBMS_OUTPUT.PUT_LINE('<TR>');
DBMS_OUTPUT.PUT_LINE('<TD style="font-family: monospace; font-weight: bold; background-color:#DEDEDE">' ||cur.mtime|| '<EM></TD>');
DBMS_OUTPUT.PUT_LINE( DataCell(cur."00-01_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."01-02_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."02-03_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."03-04_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."04-05_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."05-06_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."06-07_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."07-08_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."08-09_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."09-10_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."10-11_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."11-12_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."12-13_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."13-14_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."14-15_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."15-16_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."16-17_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."17-18_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."18-19_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."19-20_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."20-21_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."21-22_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."22-23_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE( DataCell(cur."23-24_ ",myGraphType) );
DBMS_OUTPUT.PUT_LINE('</TR>');
END LOOP;
DBMS_OUTPUT.PUT_LINE('</TABLE>');
DBMS_OUTPUT.PUT_LINE('</HTML>');
END;
/
spool off;
output : 12c recover table
- Détails
- Catégorie : Uncategorised
- Publié le dimanche 20 septembre 2015 19:31
- Écrit par Administrator
- Affichages : 55951
RMAN> RECOVER TABLE 'USERTEST1'.'TEST' OF PLUGGABLE DATABASE SHAKA
UNTIL SCN 1768101
AUXILIARY DESTINATION '/oracle/oradata/RESTOTEMP'
REMAP TABLE 'USERTEST1'.'TEST':'TEST_RESTO';2> 3> 4>
Starting recover at 17-SEP-15
using target database control file instead of recovery catalog
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified Point-in-Time
List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1
Creating automatic instance, with SID='khwb'
initialization parameters used for automatic instance:
db_name=BIGDB
db_unique_name=khwb_pitr_SHAKA_BIGDB
compatible=12.1.0.2.0
db_block_size=8192
db_files=200
diagnostic_dest=/oracle/oraBase
_system_trig_enabled=FALSE
sga_target=1056M
processes=200
db_create_file_dest=/oracle/oradata/RESTOTEMP
log_archive_dest_1='location=/oracle/oradata/RESTOTEMP'
enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used
starting up automatic instance BIGDB
Oracle instance started
Total System Global Area 1107296256 bytes
Fixed Size 2923488 bytes
Variable Size 318768160 bytes
Database Buffers 771751936 bytes
Redo Buffers 13852672 bytes
Automatic instance created
contents of Memory Script:
{
# set requested point in time
set until scn 1768101;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET until clause
Starting restore at 17-SEP-15
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=21 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 /oracle/orafra/BIGDB/autobackup/2015_09_17/o1_mf_s_890689625_bzp65stt_.bkp
channel ORA_AUX_DISK_1: piece handle=/oracle/orafra/BIGDB/autobackup/2015_09_17/o1_mf_s_890689625_bzp65stt_.bkp tag=TAG20150917T214705
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oracle/oradata/RESTOTEMP/BIGDB/controlfile/o1_mf_bzp6l7w3_.ctl
Finished restore at 17-SEP-15
sql statement: alter database mount clone database
sql statement: alter system archive log current
contents of Memory Script:
{
# set requested point in time
set until scn 1768101;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile 1 to new;
set newname for clone datafile 5 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 7 to new;
set newname for clone datafile 8 to new;
set newname for clone tempfile 1 to new;
set newname for clone tempfile 3 to new;
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile 1, 5, 3, 7, 8;
switch clone datafile all;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_temp_%u_.tmp in control file
renamed tempfile 3 to /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_temp_%u_.tmp in control file
Starting restore at 17-SEP-15
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 /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oracle/orafra/BIGDB/backupset/2015_09_17/o1_mf_nnndf_TAG20150917T214445_bzp61fqg_.bkp
channel ORA_AUX_DISK_1: piece handle=/oracle/orafra/BIGDB/backupset/2015_09_17/o1_mf_nnndf_TAG20150917T214445_bzp61fqg_.bkp tag=TAG20150917T214445
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15
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 00007 to /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oracle/orafra/BIGDB/1FE4958522E127B3E05346000A0A3C14/backupset/2015_09_17/o1_mf_nnndf_TAG20150917T214630_bzp64pfz_.bkp
channel ORA_AUX_DISK_1: piece handle=/oracle/orafra/BIGDB/1FE4958522E127B3E05346000A0A3C14/backupset/2015_09_17/o1_mf_nnndf_TAG20150917T214630_bzp64pfz_.bkp tag=TAG20150917T214630
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 17-SEP-15
datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=890690141 file name=/oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_system_bzp6lgss_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=7 STAMP=890690141 file name=/oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_undotbs1_bzp6lgr3_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=890690141 file name=/oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_sysaux_bzp6lgsy_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=9 STAMP=890690141 file name=/oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_system_bzp6nsxh_.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=10 STAMP=890690141 file name=/oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_sysaux_bzp6nsw8_.dbf
contents of Memory Script:
{
# set requested point in time
set until scn 1768101;
# online the datafiles restored or switched
sql clone "alter database datafile 1 online";
sql clone "alter database datafile 5 online";
sql clone "alter database datafile 3 online";
sql clone 'SHAKA' "alter database datafile
7 online";
sql clone 'SHAKA' "alter database datafile
8 online";
# recover and open database read only
recover clone database tablespace "SYSTEM", "UNDOTBS1", "SYSAUX", "SHAKA":"SYSTEM", "SHAKA":"SYSAUX";
sql clone 'alter database open read only';
}
executing Memory Script
executing command: SET until clause
sql statement: alter database datafile 1 online
sql statement: alter database datafile 5 online
sql statement: alter database datafile 3 online
sql statement: alter database datafile 7 online
sql statement: alter database datafile 8 online
Starting recover at 17-SEP-15
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 178 is already on disk as file /oracle/orafra/BIGDB/archivelog/2015_09_17/o1_mf_1_178_bzp6kppd_.arc
archived log file name=/oracle/orafra/BIGDB/archivelog/2015_09_17/o1_mf_1_178_bzp6kppd_.arc thread=1 sequence=178
media recovery complete, elapsed time: 00:00:01
Finished recover at 17-SEP-15
sql statement: alter database open read only
contents of Memory Script:
{
sql clone 'alter pluggable database SHAKA open read only';
}
executing Memory Script
sql statement: alter pluggable database SHAKA open read only
contents of Memory Script:
{
sql clone "create spfile from memory";
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set control_files =
''/oracle/oradata/RESTOTEMP/BIGDB/controlfile/o1_mf_bzp6l7w3_.ctl'' comment=
''RMAN set'' scope=spfile";
shutdown clone immediate;
startup clone nomount;
# mount database
sql clone 'alter database mount clone database';
}
executing Memory Script
sql statement: create spfile from memory
database closed
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1107296256 bytes
Fixed Size 2923488 bytes
Variable Size 318768160 bytes
Database Buffers 771751936 bytes
Redo Buffers 13852672 bytes
sql statement: alter system set control_files = ''/oracle/oradata/RESTOTEMP/BIGDB/controlfile/o1_mf_bzp6l7w3_.ctl'' comment= ''RMAN set'' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1107296256 bytes
Fixed Size 2923488 bytes
Variable Size 318768160 bytes
Database Buffers 771751936 bytes
Redo Buffers 13852672 bytes
sql statement: alter database mount clone database
contents of Memory Script:
{
# set requested point in time
set until scn 1768101;
# set destinations for recovery set and auxiliary set datafiles
set newname for datafile 9 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile 9;
switch clone datafile all;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
Starting restore at 17-SEP-15
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=21 device type=DISK
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 00009 to /oracle/oradata/RESTOTEMP/KHWB_PITR_SHAKA_BIGDB/datafile/o1_mf_users_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oracle/orafra/BIGDB/1FE4958522E127B3E05346000A0A3C14/backupset/2015_09_17/o1_mf_nnndf_TAG20150917T214630_bzp64pfz_.bkp
channel ORA_AUX_DISK_1: piece handle=/oracle/orafra/BIGDB/1FE4958522E127B3E05346000A0A3C14/backupset/2015_09_17/o1_mf_nnndf_TAG20150917T214630_bzp64pfz_.bkp tag=TAG20150917T214630
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 17-SEP-15
datafile 9 switched to datafile copy
input datafile copy RECID=12 STAMP=890690227 file name=/oracle/oradata/RESTOTEMP/KHWB_PITR_SHAKA_BIGDB/datafile/o1_mf_users_bzp6qtvd_.dbf
contents of Memory Script:
{
# set requested point in time
set until scn 1768101;
# online the datafiles restored or switched
sql clone 'SHAKA' "alter database datafile
9 online";
# recover and open resetlogs
recover clone database tablespace "SHAKA":"USERS", "SYSTEM", "UNDOTBS1", "SYSAUX", "SHAKA":"SYSTEM", "SHAKA":"SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script
executing command: SET until clause
sql statement: alter database datafile 9 online
Starting recover at 17-SEP-15
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 178 is already on disk as file /oracle/orafra/BIGDB/archivelog/2015_09_17/o1_mf_1_178_bzp6kppd_.arc
archived log file name=/oracle/orafra/BIGDB/archivelog/2015_09_17/o1_mf_1_178_bzp6kppd_.arc thread=1 sequence=178
media recovery complete, elapsed time: 00:00:01
Finished recover at 17-SEP-15
database opened
contents of Memory Script:
{
sql clone 'alter pluggable database SHAKA open';
}
executing Memory Script
sql statement: alter pluggable database SHAKA open
contents of Memory Script:
{
# create directory for datapump import
sql 'SHAKA' "create or replace directory
TSPITR_DIROBJ_DPDIR as ''
/oracle/oradata/RESTOTEMP''";
# create directory for datapump export
sql clone 'SHAKA' "create or replace directory
TSPITR_DIROBJ_DPDIR as ''
/oracle/oradata/RESTOTEMP''";
}
executing Memory Script
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/oracle/oradata/RESTOTEMP''
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/oracle/oradata/RESTOTEMP''
Performing export of tables...
EXPDP> Starting "SYS"."TSPITR_EXP_khwb_tmtv":
EXPDP> Estimate in progress using BLOCKS method...
EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
EXPDP> Total estimation using BLOCKS method: 128 MB
EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
EXPDP> Processing object type TABLE_EXPORT/TABLE/IDENTITY_COLUMN
EXPDP> Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
EXPDP> . . exported "USERTEST1"."TEST" 104.0 MB 1572864 rows
EXPDP> Master table "SYS"."TSPITR_EXP_khwb_tmtv" successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TSPITR_EXP_khwb_tmtv is:
EXPDP> /oracle/oradata/RESTOTEMP/tspitr_khwb_83761.dmp
EXPDP> Job "SYS"."TSPITR_EXP_khwb_tmtv" successfully completed at Thu Sep 17 21:58:55 2015 elapsed 0 00:00:44
Export completed
contents of Memory Script:
{
# shutdown clone before import
shutdown clone abort
}
executing Memory Script
Oracle instance shut down
Performing import of tables...
IMPDP> Master table "SYS"."TSPITR_IMP_khwb_bhos" successfully loaded/unloaded
IMPDP> Starting "SYS"."TSPITR_IMP_khwb_bhos":
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
IMPDP> . . imported "USERTEST1"."TEST_RESTO" 104.0 MB 1572864 rows
IMPDP> Processing object type TABLE_EXPORT/TABLE/IDENTITY_COLUMN
IMPDP> ORA-39083: Object type IDENTITY_COLUMN:"USERTEST1" failed to create with error:
ORA-38301: can not perform DDL/DML over objects in Recycle Bin
Failing sql is:
ALTER TABLE "USERTEST1"."BIN$H/c86Y0pC77gU0YACgreOg==$0" MODIFY ("ID" GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH LIMIT VALUE CACHE 20 NOORDER NOCYCLE )
IMPDP> Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
IMPDP> ORA-31684: Object type CONSTRAINT:"USERTEST1"."SYS_C009993" already exists
IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
IMPDP> Job "SYS"."TSPITR_IMP_khwb_bhos" completed with 2 error(s) at Thu Sep 17 21:59:56 2015 elapsed 0 00:00:47
import completed with errors; Oracle Data Pump dump file tspitr_khwb_83761.dmp is retained
Removing automatic instance
Automatic instance removed
auxiliary instance file /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_temp_bzp6p9xf_.tmp deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_temp_bzp6p1kk_.tmp deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/KHWB_PITR_SHAKA_BIGDB/onlinelog/o1_mf_3_bzp6rsgm_.log deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/KHWB_PITR_SHAKA_BIGDB/onlinelog/o1_mf_2_bzp6rrfg_.log deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/KHWB_PITR_SHAKA_BIGDB/onlinelog/o1_mf_1_bzp6rq2c_.log deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/KHWB_PITR_SHAKA_BIGDB/datafile/o1_mf_users_bzp6qtvd_.dbf deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_sysaux_bzp6nsw8_.dbf deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_system_bzp6nsxh_.dbf deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_sysaux_bzp6lgsy_.dbf deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_undotbs1_bzp6lgr3_.dbf deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/BIGDB/datafile/o1_mf_system_bzp6lgss_.dbf deleted
auxiliary instance file /oracle/oradata/RESTOTEMP/BIGDB/controlfile/o1_mf_bzp6l7w3_.ctl deleted
Finished recover at 17-SEP-15
TDE (Part II) : Annexe
- Détails
- Catégorie : Uncategorised
- Publié le samedi 18 janvier 2014 21:41
- Écrit par Administrator
- Affichages : 52957
Script1
Remplacer <table> dans le script ci-dessous par le nom de la table : CRYPT puis et exécuter sous sqlplus le script. Attention ne pas se connecter avec SYS, il n'a pas le droit de créer des tables chiffrées.
Puis recommencer l'opération avec <table> COL_CRYPT puis COL_SALT_CRYPT et enfin PAS_CRYPT
begin
for l_id in 1..1000000 loop
insert into <table>
values
(
l_id,
decode (
floor(dbms_random.value(1,22)),
1, 'Pas trop secret ',
2, 'public',
3, 'pour tout le monde',
4, 'quoi?',
5, 'hein',
6, 'donnee qui sert à rien',
7, 'patati patata',
8, 'bonjour',
9, 'PAS SECRET',
10, 'rgte ghegergfzrgfcrgthsg',
11, 'Bonsoir',
12, 'PAS TROP SECRET ',
13, 'PUBLIC',
14, 'POUR TOUT LE MONDE',
15, 'QUOI?',
16, 'HEIN',
17, 'DONNEE QUI SERT À RIEN',
18, 'PATATI PATATA',
19, 'BONJOUR',
20, 'PAS SECRET',
21, 'RGTE GHEGERGFZRGFCRGTHSG',
22, 'BONSOIR',
'XXX'
),
decode (
floor(dbms_random.value(1,22)),
1, 'TROP SECRET',
2, '54 50 600 454',
3, 'mot de passe : Trde45seZA%der',
4, '1 74 255 603 121 13',
5, 'SECRET',
6, 'Ultra Secret',
7, 'NE PAS LIRE',
8, 'La NSA controle internet',
9, 'La NSA espionne la DGSE',
10, 'La NSA decrypte cette colonne',
11, 'La NSA est coquine',
12, 'TROP SECRET',
13, '54 50 600 454',
14, 'MOT DE PASSE : TRDE45SEZA%DER',
15, '1 74 255 603 121 13',
16, 'SECRET',
17, 'ULTRA SECRET',
18, 'NE PAS LIRE',
19, 'LA NSA CONTROLE INTERNET',
20, 'LA NSA ESPIONNE LA DGSE',
21, 'LA NSA DECRYPTE CETTE COLONNE',
22, 'LA NSA EST COQUINE',
'XXX'
)
);
end loop;
commit;
end;
/
commit;
Script 2
-- envoi_le_bourrier.sql (pouvez pas comprendre, faut être passer par France Télévision Publicité fin de années 90 pour comprendre!)
alter system archive log current;
SET SERVEROUTPUT ON SIZE UNLIMITED
DECLARE
l_loops NUMBER := 100000;
l_data VARCHAR2(50);
l_start NUMBER;
BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE simple_table';
l_start := DBMS_UTILITY.get_time;
FOR i IN 1 .. l_loops LOOP
INSERT INTO simple_table (id, data)
VALUES (i, 'Data for ' || i);
END LOOP;
DBMS_OUTPUT.put_line('Insert : ' || (DBMS_UTILITY.get_time - l_start));
l_start := DBMS_UTILITY.get_time;
FOR i IN 1 .. l_loops LOOP
SELECT data
INTO l_data
FROM simple_table
WHERE id = i;
END LOOP;
DBMS_OUTPUT.put_line('Select : ' || (DBMS_UTILITY.get_time - l_start));
END;
/
select sum(bytes)/1024/1024 from dba_segments where segment_name='SIMPLE_TABLE';
Mon Parcours
- Détails
- Catégorie : Uncategorised
- Publié le vendredi 31 janvier 2014 22:16
- Écrit par Administrator
- Affichages : 11111
20 ans que je travaille avec Oracle, de la version 7 à 19c, une évolution constante.
Je n’ai pas fait d’études informatiques, mais des études de physico-chimie, plus précisément j’ai un DESS d’instrumentation et méthode physico-chimique d’analyse.
Quand j’ai cherché un emploi après l’armée :
10 lettres de motivation en chimie, 0 réponse, même pas une réponse négative !
10 lettres de motivation en informatique, 10 réponses positives, 10 entretiens, et sur certains entretiens avant même la fin de l’entretien on me faisait comprendre que j’étais pris.
J’ai donc « épousé » une carrière informatique…
La découverte
Mon premier poste a été développeur à CapGemini en 1998 : conception et développement en C++ lors d’une première mission. Ne connaissant pas du tout les métiers dans l’informatique, j’ai découvert lors de cette première expérience, le métier d’administrateur au contact d’autres informaticiens, et plus particulièrement « Administrateur de base de données » : DBA. C’est au bout de 6 mois de développement, que j’ai alors décidé que je serai DBA, et pas autre chose. J’ai demandé à changer de métier et je me suis retrouvé DBA (Informix).
DBA junior
Fin 1999, je rentre chez France Télévision Publicité, en tant que DBA Oracle. On peut dire que c’est dans cette société que j’ai appris toutes les connaissances de base que je possède aujourd’hui. J’étais donc le DBA Oracle, mais aussi administrateur Unix/Linux. J’étais dans une petite équipe d’administrateurs. Il y avait un administrateur Netware/Windows/Messagerie, un administrateur Réseau/Unix et il fallait savoir un peu faire le travail du collègue.
DBA senior
De 2008 à 2010, changement de cap : Atos Origin Infogérance, de nombreuses bases à infogérer (quelques milliers). C’est un autre monde, une autre organisation que dans mon précédent poste. Le DBA est DBA avec une spécialisation dans un moteur SGBD, l’administrateur Unix est administrateur UNIX avec une spécialisation dans un Unix, l’ingénieur stockage..., l’ingénieur sauvegarde…, l’ingénieur réseau…, l’ingénieur applicatif…. Mon poste consistait dans un premier temps à résoudre des incidents niveau 2 et 3 de production, ensuite j’ai pu participer à des reprises de comptes, des mises en place de système en collaboration avec les autres équipes techniques. J’y ai aussi appris à administrer deux nouveaux SGBD : SqlServer et DB2.
Vers l’expertise
En novembre 2010, j’ai changé de société pour aller chez Morpho filiale du groupe SAFRAN, revendu en 2017 à Oberthur Technologies. L’environnement technique Oracle est très motivant, il me permet de me perfectionner sur de nombreuses technologies Oracle : RAC/Extented-RAC, Dataguard, RMAN, ASM, Advanced Security, Vault Database, Oracle Secure backup, ACFS/DBFS…
Mes missions sont :
- Installation hétérogène : Cluster (RAC et RAC étendu), Réplication (Dataguard, Standby, GoldenGate…), Standalone, Grid infrastructure… sur Unix, Linux ou Windows
- Sécurisation : Oracle Database Vault, Transparent Data Encryption, Oracle Key Vault, Audit Fine grain, Network encryption…
- Migration, upgrade : changement de version, d’OS (big/little endian), d’architecture, migration vers le Cloud…
- Mise en place et support de systèmes répliqués : Dataguard, DBVisit Standby, GoldenGate, Symmetric DS…
- Backup/Restore/Clonage : gestion de grosse volumétrie : Incremental Updated Backup, partitionnement et tablespace read-only, snapshot baie, support niveau 3…
- Spécifications et préconisations : choix des technologies, procédures d’installation…
- Ecriture et maintenance d’outil d’administration : scripts de backup, de monitoring et sonde (snmp, nagios…), d’installation/déploiement grid et database software, de hardening, de création de base de données multi environnement, d’administration DataGuard, de rotation/purge des logs Oracle…
- Développement PL/SQL.
- Tuning.
- Assistance et support niveau 3.
- Veille technologique.
En dehors de mon travail, il m’arrive de faire de la veille technologique par passion pour mon métier, mais aussi parce que, professionnellement je n’ai pas toujours beaucoup de temps à y consacrer. J’ai donc des compétences techniques acquises dans un environnement non professionnel comme : Oracle Redaction, Oracle Transparent Sensitive protection Data, Oracle Audit Vault & Firewall, Oracle Entreprise Manager.
Et ensuite... consulting?
Resto OCR et Voting : Annexe 1
- Détails
- Catégorie : Uncategorised
- Publié le lundi 22 avril 2013 21:26
- Écrit par Administrator
- Affichages : 51515
Tentative de monter l'OCRVOT
SQL> alter diskgroup OCRVOT mount force;
alter diskgroup OCRVOT mount force
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15040: diskgroup is incomplete
ORA-15066: offlining disk "2" in group "OCRVOT" may result in a data loss
ORA-15042: ASM disk "2" is missing from group number "4"
ORA-15042: ASM disk "1" is missing from group number "4"
--> normal 1 disque sur 3, impossible de monter
Tentative de créer l'OCRVOT
SQL>create Diskgroup OCRVOT normal redundancy disk '/dev/oracleasm/disks/OCRVOT1', '/dev/oracleasm/disks/OCRVOT2', '/dev/oracleasm/disks/OCRVOT3';
--> échec: normal existe déja
Tentative de forcer l'ajout des disques nouvellement instanciés
SQL> alter diskgroup OCRVOT add disk '/dev/oracleasm/disks/OCRVOT2' force;
alter diskgroup OCRVOT add disk '/dev/oracleasm/disks/OCRVOT2' force
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15001: diskgroup "OCRVOT" does not exist or is not mounted
--> Ben oui pas monté c’est bien le problème
Tentative de droper OCRVOT
SQL> drop diskgroup OCRVOT;
drop diskgroup OCRVOT
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15276: ASM diskgroup OCRVOT has cluster voting files
--> Ben oui il y a le voting qui est dessus et en plus il est up
Alors on va déplacer le voting sur un autre disk group :
[root@racdb1 ~]# /oracle/11.2.0.3/grid/bin/crsctl replace votedisk +DATA1
Oracle Cluster Registry initialization failed accessing Oracle Cluster Registry device: PROC-26: Error while accessing the physical storage
CRS-4000: Command Replace failed, or completed with errors.
--> On se mord la queue, on ne peut pas car l’OCR n’est pas up!!! et
D'où la suppression du voting pour sortir de ce cycle infernal