2014. 9. 29. 16:39 오라클

em default port 확인


em 12c 의 default port list


설치시 제공하는 화면 참고






Posted by pat98

아래와 같은 script 로 oracle 옵션의 사용유무를 Check 할수 있다.


dba_feature_usage_statistics 뷰를 사용한다.


====================================================


SET LINESIZE 180;

SET PAGESIZE 1000;

SET FEEDBACK OFF;

SET COLSEP '|';

WHENEVER SQLERROR EXIT SQL.SQLCODE;


COL "Host Name" FORMAT A30;

COL "Option/Management Pack" FORMAT A60;

COL "Used" FORMAT A5;

with features as(

select a OPTIONS, b NAME  from

(

select 'Active Data Guard' a,  'Active Data Guard - Real-Time Query on Physical Standby' b from dual

union all 

select 'Advanced Compression', 'HeapCompression' from dual

union all

select 'Advanced Compression', 'Backup BZIP2 Compression' from dual

union all 

select 'Advanced Compression', 'Backup DEFAULT Compression' from dual

union all 

select 'Advanced Compression', 'Backup HIGH Compression' from dual

union all

select 'Advanced Compression', 'Backup LOW Compression' from dual

union all

select 'Advanced Compression', 'Backup MEDIUM Compression' from dual

union all

select 'Advanced Compression', 'Backup ZLIB, Compression' from dual

union all

select 'Advanced Compression', 'SecureFile Compression (user)' from dual

union all

select 'Advanced Compression', 'SecureFile Deduplication (user)' from dual

union all

select 'Advanced Compression',        'Data Guard' from dual

union all

select 'Advanced Compression', 'Oracle Utility Datapump (Export)' from dual

union all

select 'Advanced Compression', 'Oracle Utility Datapump (Import)' from dual

union all

select 'Advanced Security', 'ASO native encryption and checksumming' from dual

union all

select 'Advanced Security', 'Transparent Data Encryption' from dual

union all

select 'Advanced Security', 'Encrypted Tablespaces' from dual

union all

select 'Advanced Security', 'Backup Encryption' from dual

union all

select 'Advanced Security', 'SecureFile Encryption (user)' from dual

union all

select 'Change Management Pack', 'Change Management Pack (GC)' from dual

union all

select 'Data Masking Pack', 'Data Masking Pack (GC)' from dual

union all

select 'Data Mining', 'Data Mining' from dual

union all

select 'Diagnostic Pack',   'Diagnostic Pack' from dual

union all

select 'Diagnostic Pack',   'ADDM' from dual

union all

select 'Diagnostic Pack',   'AWR Baseline' from dual

union all

select 'Diagnostic Pack',   'AWR Baseline Template' from dual

union all

select 'Diagnostic Pack',   'AWR Report' from dual

union all

select 'Diagnostic Pack',   'Baseline Adaptive Thresholds' from dual

union all

select 'Diagnostic Pack',   'Baseline Static Computations' from dual

union all

select 'Tuning  Pack',   'Tuning Pack' from dual

union all

select 'Tuning  Pack',   'Real-Time SQL Monitoring' from dual

union all

select 'Tuning  Pack',   'SQL Tuning Advisor' from dual

union all

select 'Tuning  Pack',   'SQL Access Advisor' from dual

union all

select 'Tuning  Pack',   'SQL Profile' from dual

union all

select 'Tuning  Pack',   'Automatic SQL Tuning Advisor' from dual

union all

select 'Database Vault',   'Oracle Database Vault' from dual

union all

select 'WebLogic Server Management Pack Enterprise Edition',   'EM AS Provisioning and Patch Automation (GC)' from dual

union all

select 'Configuration Management Pack for Oracle Database',   'EM Config Management Pack (GC)' from dual

union all

select 'Provisioning and Patch Automation Pack for Database',   'EM Database Provisioning and Patch Automation (GC)' from dual

union all

select 'Provisioning and Patch Automation Pack',   'EM Standalone Provisioning and Patch Automation Pack (GC)' from dual

union all

select 'Exadata',   'Exadata' from dual

union all

select 'Label Security',   'Label Security' from dual

union all

select 'OLAP',   'OLAP - Analytic Workspaces' from dual

union all

select 'Partitioning',   'Partitioning (user)' from dual

union all

select 'Real Application Clusters',   'Real Application Clusters (RAC)' from dual

union all

select 'Real Application Testing',   'Database Replay: Workload Capture' from dual

union all

select 'Real Application Testing',   'Database Replay: Workload Replay' from dual

union all

select 'Real Application Testing',   'SQL Performance Analyzer' from dual

union all

select 'Spatial' ,'Spatial (Not used because this does not differential usage of spatial over locator, which is free)' from dual

union all

select 'Total Recall', 'Flashback Data Archive' from dual

)

)

select t.o "Option/Management Pack", 

       t.u "Used",

       d.DBID "DBID",

       d.name "DB Name",

       i.version "DB Version",

       i.host_name "Host Name",

       to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') "ReportGen Time"

from

(select OPTIONS o, DECODE(sum(num),0,'NO','YES') u

from

(

select f.OPTIONS OPTIONS, case

                   when f_stat.name is null then 0

                   when ( ( f_stat.currently_used = 'TRUE' and

                            f_stat.detected_usages > 0 and

                            (sysdate - f_stat.last_usage_date) < 366 and

                            f_stat.total_samples > 0

                          )

                          or 

                          (f_stat.detected_usages > 0 and 

                          (sysdate - f_stat.last_usage_date) < 366 and

                          f_stat.total_samples > 0)

                        ) and 

                        ( f_stat.name not in('Data Guard', 'Oracle Utility Datapump (Export)', 'Oracle Utility Datapump (Import)')

                          or

                          (f_stat.name in('Data Guard', 'Oracle Utility Datapump (Export)', 'Oracle Utility Datapump (Import)') and

                           f_stat.feature_info is not null and trim(substr(to_char(feature_info), instr(to_char(feature_info), 'compression used: ',1,1) + 18, 2)) != '0')

                        )

                        then 1

                   else 0

                  end num

  from features f,

       sys.dba_feature_usage_statistics f_stat

where f.name = f_stat.name(+)

) group by options) t,

  v$instance i,

  v$database d

order by 2 desc,1 

;


exit;

Posted by pat98

2014. 9. 19. 13:06 오라클

Exadata 설치문서




올해 초 쯤에 작성한 Exadata 설치문서 PPT 


Exadata Setup &amp; Install(김종인).ppt



Posted by pat98

Raw Device 에서 File System 으로 데이타파일 변환하기


RMAN 을 사용하여 데이타파일 을 raw device 에서 file system 으로 옮긴다.

1. 데이타베이스에 접속한다:

 $ sqlplus system/manager@orcl

2. 변환하고자 하는 데이타파일이 속한 테이블스페이스를  offline 시킨다:

 SQL> alter tablespace test_ts offline; 

3. rman을 시작하여 데이타베이스에 접속한다:
 
 $ rman nocatalog target rman/rman@orcl

4. 데이타파일 을 raw device 에서 file system 으로 옮긴다:

 RMAN> run { 
 2> allocate channel c1 type disk; 
 3> copy datafile '/dev/raw1' to '/u01/oradata/orcl/test_ts.dbf'; 
 4> } 

5. 옮겨진 데이타파일을 Rename 한다:

 SQL> alter database rename file '/dev/raw1' to '/u01/oradata/orcl/test_ts.
dbf'; 

6. 테이블스페이스를 online상태로 바꾼다:

 SQL> alter tablespace test_ts online; 


주의: 
======
1. 백업 툴로써 RMAN 을 사용한다면 백업을 수행하고 절차를 수행하기를 권고한다. 왜냐하면 그렇지 않으면 RMAN 은 복사한 파일을 백업으로써  간주하기 때문이다. 

2. 일반적으로 오라클 데이타파일은 dd 을 사용하여 file system 에서 raw device 로 옮겨진다. dd 을 사용하는 것이 데이타파일을 옯기는 부분에서 가장 빠른 방법이다. 
하지만 운영체제가 덮어쓰지 않도록  raw device 에서 얼마나 많은 블럭이 스킵되어야 하는지를 알 필요가 있다. ( 예를 들면, Tru64 Unix 에서는 64K 을 스킵할 필요가 있다.)
얼마나 많은 블럭이 스킵되어야 하는지에 대한 정보는 플랫폼마다 다르다. RMAN 을 사용하는 경우 이러한 플랫폼별 정보를 알 필요 없다.


Posted by pat98


확인이 필요하여 테스트 해봄


1. NOMOUNT 단계시 listener status 및 접속가능여부


SYS@ORCL> startup nomount

ORACLE instance started.


Total System Global Area  617975808 bytes

Fixed Size                  2255752 bytes

Variable Size             398460024 bytes

Database Buffers          213909504 bytes

Redo Buffers                3350528 bytes


none> select status from v$instance;


STATUS

------------------------------------

STARTED


[oracle:/home/oracle]#lsnrctl status


LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 16-SEP-2014 14:56:31


Copyright (c) 1991, 2013, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                16-SEP-2014 14:56:18

Uptime                    0 days 0 hr. 0 min. 12 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oracle/product/11.2.0.4/network/admin/listener.ora

Listener Log File         /oracle/diag/tnslsnr/single/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.50)(PORT=1521)))

Services Summary...

Service "ORCL" has 1 instance(s).

  Instance "ORCL", status BLOCKED, has 1 handler(s) for this service...

The command completed successfully


접속 시도해봄


[oracle:/home/oracle]#sqlplus system/manager@ORCL


SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 16 15:05:04 2014


Copyright (c) 1982, 2013, Oracle.  All rights reserved.


ERROR:

ORA-12528: TNS:listener: all appropriate instances are blocking new connections


2. MOUNT 단계시 listener status 및 접속가능여부


none> startup mount

ORACLE instance started.


Total System Global Area  617975808 bytes

Fixed Size                  2255752 bytes

Variable Size             398460024 bytes

Database Buffers          213909504 bytes

Redo Buffers                3350528 bytes

Database mounted.

none> select status from v$instance;


STATUS

------------------------------------

MOUNTED


[oracle:/home/oracle]#lsnrctl status


LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 16-SEP-2014 15:01:04


Copyright (c) 1991, 2013, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                16-SEP-2014 14:56:18

Uptime                    0 days 0 hr. 4 min. 45 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oracle/product/11.2.0.4/network/admin/listener.ora

Listener Log File         /oracle/diag/tnslsnr/single/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.50)(PORT=1521)))

Services Summary...

Service "ORCL" has 1 instance(s).

  Instance "ORCL", status READY, has 1 handler(s) for this service...

The command completed successfully


[oracle:/home/oracle]#sqlplus system/manager@ORCL


SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 16 15:07:40 2014


Copyright (c) 1982, 2013, Oracle.  All rights reserved.


ERROR:

ORA-01033: ORACLE initialization or shutdown in progress

Process ID: 0

Session ID: 0 Serial number: 0


3. open시는 당연하므로 패스..

Posted by pat98

2014. 9. 16. 14:55 오라클

rman duplicate



11g 에서는 rman 을 이용하여 DB가 백업본이 없어도 운영중인 상태에서 복제가 가능하다.(FROM ACTIVE DATABASE 이용)


현재 서버 ORCL DB -> 다른서버의 ORCL2 라는 이름으로  복제해 보자. 귀찮아서 새로운 서버의 화일 경로는 바꾸지 않았다.

 

1. source 와 target에서 각각의 서비스를 tnsnames.ora 에 모두 반영

 

target 관련 TNS에는 from active database 옵션을 써서 복제할 경우 startup nomount 상태시 target 의 listener 가 blocking 되어 통신이 되지 않으므로 (UR=A) 항목을 추가해 줘서 에러를 방지해 준다.

 

TEST2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = single2)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TEST2) (UR=A)
    )
  )


2. 양쪽 listener start 


3. source 에서 pfile 을 생성하여 target 환경에 맞게 수정후 init 화일 생성


SQL> create pfile from spfile;


생성된 pfile 을 이용하여 target 에 init화일을 생성해준다.


환경에 맞게 db_name 등을 수정반영


ORCL.__db_cache_size=197132288

ORCL.__java_pool_size=4194304

ORCL.__db_cache_size=197132288

ORCL.__java_pool_size=4194304

ORCL.__large_pool_size=4194304

ORCL.__oracle_base='/oracle'#ORACLE_BASE set from environment

ORCL.__pga_aggregate_target=251658240

ORCL.__sga_target=369098752

ORCL.__shared_io_pool_size=0

ORCL.__shared_pool_size=150994944

ORCL.__streams_pool_size=0

*.audit_file_dest='/oracle/admin/ORCL/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='/oradata/control01.ctl','/oradata/control02.ctl','/oradata/control03.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='ORCL2'

*.diagnostic_dest='/oracle/'

*.log_archive_dest_1='LOCATION=/oradata/arch'

*.log_archive_format='arch_%t_%r_%s.arc'

*.memory_target=620756992

*.open_cursors=300

*.processes=500


4. target 에서 원격접속을 위해 passwd 화일 생성


[oracle:/oracle/product/11.2.0.4/dbs]#orapwd file=orapwORCL2 password=manager entries=10


5. nomount 로 DB기동


export ORACLE_SID=ORCL2

sqlplus "/as sysdba"


SQL> startup nomount


6. rman 접속


target 에서


[oracle:/home/oracle]#rman target sys/manager@ORCL auxiliary sys/manager@ORCL2



Recovery Manager: Release 11.2.0.4.0 - Production on Tue Sep 16 14:37:21 2014


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (DBID=1380694829)

connected to auxiliary database: ORCL2 (not mounted)


DUPLICATE TARGET DATABASE TO "ORCL2"

FROM ACTIVE DATABASE

SPFILE

NOFILENAMECHECK;

      

Starting Duplicate Db at 16-SEP-2014 14:37:32

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=19 device type=DISK


contents of Memory Script:

{

   backup as copy reuse

   targetfile  '/oracle/product/11.2.0.4/dbs/spfileORCL.ora' auxiliary format 

 '/oracle/product/11.2.0.4/dbs/spfileORCL2.ora'   ;

   sql clone "alter system set spfile= ''/oracle/product/11.2.0.4/dbs/spfileORCL2.ora''";

}

executing Memory Script


Starting backup at 16-SEP-2014 14:37:33

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=35 device type=DISK

Finished backup at 16-SEP-2014 14:37:35


sql statement: alter system set spfile= ''/oracle/product/11.2.0.4/dbs/spfileORCL2.ora''


contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''ORCL2'' comment=

 ''duplicate'' scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script


sql statement: alter system set  db_name =  ''ORCL2'' comment= ''duplicate'' scope=spfile


Oracle instance shut down


connected to auxiliary database (not started)

Oracle instance started


Total System Global Area     617975808 bytes


Fixed Size                     2255752 bytes

Variable Size                398460024 bytes

Database Buffers             213909504 bytes

Redo Buffers                   3350528 bytes


contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''ORCL'' comment=

 ''Modified by RMAN duplicate'' scope=spfile";

   sql clone "alter system set  db_unique_name = 

 ''ORCL2'' comment=

 ''Modified by RMAN duplicate'' scope=spfile";

   shutdown clone immediate;

   startup clone force nomount

   backup as copy current controlfile auxiliary format  '/oradata/control01.ctl';

   restore clone controlfile to  '/oradata/control02.ctl' from 

 '/oradata/control01.ctl';

   restore clone controlfile to  '/oradata/control03.ctl' from 

 '/oradata/control01.ctl';

   alter clone database mount;

}

executing Memory Script


sql statement: alter system set  db_name =  ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile


sql statement: alter system set  db_unique_name =  ''ORCL2'' comment= ''Modified by RMAN duplicate'' scope=spfile


Oracle instance shut down


Oracle instance started


Total System Global Area     617975808 bytes


Fixed Size                     2255752 bytes

Variable Size                398460024 bytes

Database Buffers             213909504 bytes

Redo Buffers                   3350528 bytes


Starting backup at 16-SEP-2014 14:38:04

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

copying current control file

output file name=/oracle/product/11.2.0.4/dbs/snapcf_ORCL.f tag=TAG20140916T143803 RECID=3 STAMP=858436686

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

Finished backup at 16-SEP-2014 14:38:11


Starting restore at 16-SEP-2014 14:38:12

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=19 device type=DISK


channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 16-SEP-2014 14:38:13


Starting restore at 16-SEP-2014 14:38:14

using channel ORA_AUX_DISK_1


channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 16-SEP-2014 14:38:15


database mounted

RMAN-05538: WARNING: implicitly using DB_FILE_NAME_CONVERT


contents of Memory Script:

{

   set newname for datafile  1 to 

 "/oradata/system01.dbf";

   set newname for datafile  2 to 

 "/oradata/sysaux01.dbf";

   set newname for datafile  3 to 

 "/oradata/undotbs01.dbf";

   set newname for datafile  4 to 

 "/oradata/ogg01.dbf";

   backup as copy reuse

   datafile  1 auxiliary format 

 "/oradata/system01.dbf"   datafile 

 2 auxiliary format 

 "/oradata/sysaux01.dbf"   datafile 

 3 auxiliary format 

 "/oradata/undotbs01.dbf"   datafile 

 4 auxiliary format 

 "/oradata/ogg01.dbf"   ;

   sql 'alter system archive log current';

}

executing Memory Script


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


Starting backup at 16-SEP-2014 14:38:23

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=/oradata/system01.dbf

output file name=/oradata/system01.dbf tag=TAG20140916T143822

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:26

channel ORA_DISK_1: starting datafile copy

input datafile file number=00002 name=/oradata/sysaux01.dbf

output file name=/oradata/sysaux01.dbf tag=TAG20140916T143822

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:05

channel ORA_DISK_1: starting datafile copy

input datafile file number=00003 name=/oradata/undotbs01.dbf

output file name=/oradata/undotbs01.dbf tag=TAG20140916T143822

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:35

channel ORA_DISK_1: starting datafile copy

input datafile file number=00004 name=/oradata/ogg01.dbf

output file name=/oradata/ogg01.dbf tag=TAG20140916T143822

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35

Finished backup at 16-SEP-2014 14:44:05


sql statement: alter system archive log current


contents of Memory Script:

{

   backup as copy reuse

   archivelog like  "/oradata/arch/arch_1_852914093_13.arc" auxiliary format 

 "/oradata/archarch_1_852914093_13.arc"   ;

   catalog clone archivelog  "/oradata/archarch_1_852914093_13.arc";

   switch clone datafile all;

}

executing Memory Script


Starting backup at 16-SEP-2014 14:44:07

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log copy

input archived log thread=1 sequence=13 RECID=3 STAMP=858437045

output file name=/oradata/archarch_1_852914093_13.arc RECID=0 STAMP=0

channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01

Finished backup at 16-SEP-2014 14:44:09


cataloged archived log

archived log file name=/oradata/archarch_1_852914093_13.arc RECID=3 STAMP=858437050


datafile 1 switched to datafile copy

input datafile copy RECID=3 STAMP=858437051 file name=/oradata/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=4 STAMP=858437051 file name=/oradata/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=5 STAMP=858437051 file name=/oradata/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=6 STAMP=858437051 file name=/oradata/ogg01.dbf


contents of Memory Script:

{

   set until scn  342205;

   recover

   clone database

    delete archivelog

   ;

}

executing Memory Script


executing command: SET until clause


Starting recover at 16-SEP-2014 14:44:13

using channel ORA_AUX_DISK_1


starting media recovery


archived log for thread 1 with sequence 13 is already on disk as file /oradata/archarch_1_852914093_13.arc

archived log file name=/oradata/archarch_1_852914093_13.arc thread=1 sequence=13

media recovery complete, elapsed time: 00:00:01

Finished recover at 16-SEP-2014 14:44:19

Oracle instance started


Total System Global Area     617975808 bytes


Fixed Size                     2255752 bytes

Variable Size                398460024 bytes

Database Buffers             213909504 bytes

Redo Buffers                   3350528 bytes


contents of Memory Script:

{

   sql clone "alter system set  db_name = 

 ''ORCL2'' 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  db_name =  ''ORCL2'' comment= ''Reset to original value by RMAN'' scope=spfile


sql statement: alter system reset  db_unique_name scope=spfile


Oracle instance shut down


connected to auxiliary database (not started)

Oracle instance started


Total System Global Area     617975808 bytes


Fixed Size                     2255752 bytes

Variable Size                398460024 bytes

Database Buffers             213909504 bytes

Redo Buffers                   3350528 bytes

sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL2" RESETLOGS ARCHIVELOG 

  MAXLOGFILES      5

  MAXLOGMEMBERS      5

  MAXDATAFILES     1000

  MAXINSTANCES     1

  MAXLOGHISTORY      292

 LOGFILE

  GROUP   1 ( '/oradata/redo01.log' ) SIZE 100 M  REUSE,

  GROUP   2 ( '/oradata/redo02.log' ) SIZE 100 M  REUSE,

  GROUP   3 ( '/oradata/redo03.log' ) SIZE 100 M  REUSE

 DATAFILE

  '/oradata/system01.dbf'

 CHARACTER SET AL32UTF8



contents of Memory Script:

{

   set newname for tempfile  1 to 

 "/oradata/temp01.dbf";

   switch clone tempfile all;

   catalog clone datafilecopy  "/oradata/sysaux01.dbf", 

 "/oradata/undotbs01.dbf", 

 "/oradata/ogg01.dbf";

   switch clone datafile all;

}

executing Memory Script


executing command: SET NEWNAME


renamed tempfile 1 to /oradata/temp01.dbf in control file


cataloged datafile copy

datafile copy file name=/oradata/sysaux01.dbf RECID=1 STAMP=858437097

cataloged datafile copy

datafile copy file name=/oradata/undotbs01.dbf RECID=2 STAMP=858437098

cataloged datafile copy

datafile copy file name=/oradata/ogg01.dbf RECID=3 STAMP=858437098


datafile 2 switched to datafile copy

input datafile copy RECID=1 STAMP=858437097 file name=/oradata/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=858437098 file name=/oradata/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=858437098 file name=/oradata/ogg01.dbf

Reenabling controlfile options for auxiliary database

Executing: alter database add supplemental log data


contents of Memory Script:

{

   Alter clone database open resetlogs;

}

executing Memory Script


database opened

Finished Duplicate Db at 16-SEP-2014 14:45:31


끝. 10분이면 완료


복제가 잘 되었다. Archive 설정도 자동으로 되어 있다.

Single 은 초간단하게 복제 가능 !!




Posted by pat98




11g RAC 설치중 해당 과정 화면에서 root.sh 까지는 멋지게 성공하였으나 Session 오류나 기타 문제로 OUI 화면이

없어져 버렸을 경우 아래와 같이 조치하면 후속작업(Configure Oracle Grid Infrastructure for a Cluster 이하)

 계속 진행하고 마무리 지을수 있다.


$GRID_HOME/cfgtoollogs/configToolAllCommands


즉 text 모드로 진행하여 설치완료 할 수 있다.

Posted by pat98

2014. 7. 18. 22:58 오라클

scan ip 변경


SCAN IP를 105 -> 205 로 바꾸어 보자.

 

1. [root:/root]#crsctl stop crs

 

2. vi /etc/hosts

 

# SCAN
#192.168.56.105   rac-scan  

192.168.56.205   rac-scan  

 

3. [root:/root]#crsctl start crs

 

4.  확인해 보면 아직 반영 안 되어 있다.

[root:/root]#srvctl config scan
SCAN name: rac-scan, Network: 1/192.168.56.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /rac-scan/192.168.56.105

 

5. modify 해준다.

root 유저로 실행

[root:/root]#srvctl modify scan -n rac-scan

 

6. 확인 끝

[root:/root]#srvctl config scan
SCAN name: rac-scan, Network: 1/192.168.56.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /rac-scan/192.168.56.205

Posted by pat98

2014. 7. 17. 21:45 오라클

오라클 CHR 함수


 

많이 쓰이는 CHR 함수의미  정리


CHR(9)      탭문자
CHR(10)     라인피드        <- 줄바꾸기
CHR(13)     캐리지리턴     <- 행의 처음으로

CHR(38)     &
CHR(39)     '                   <- 싱글따옴표

CHR(44)     ,                   <- 쉼표

 

 

========== ASCII 코드를 캐릭터로 전환해서 보여 주는 Code ==========

 

set serveroutput on FORMAT WRAPPED
DECLARE
    vTab           VARCHAR2(5) := CHR(9);
    vNum          NUMBER := 0;
    vString       VARCHAR2(80) := '';
BEGIN  
   --
   -- Formatted lower case letter to ASCII values
   --
   dbms_output.put_line('Formatted Lower Case Letters to ASCII values');
   dbms_output.put_line('-------------------------------------------------------');
   FOR i IN ASCII('a') .. ASCII('z') LOOP
      IF vNum < 6 THEN
         vString := vString||CHR(i)||' : '||i||vTab;
         vNum := vNum + 1;
      ELSIF vNum = 6 then
         dbms_output.put_line(vString||CHR(i)||' : '||i);
         vNum := 0;
         vString := '';
      ELSE
         dbms_output.put_line('ERROR');
      END IF;
   END LOOP;
   dbms_output.put_line(vString);

   --
   -- Formatted upper case letter to ASCII values
   --
   vString := '';
   vNum := 0;

   dbms_output.new_line;
   dbms_output.new_line;
   dbms_output.put_line('Formatted Upper Case Letters to ASCII values');
   dbms_output.put_line('-------------------------------------------------------');
   FOR i IN ASCII('A') .. ASCII('Z') LOOP
      IF vNum < 6 THEN
         vString := vString||CHR(i)||' : '||i||vTab;
         vNum := vNum + 1;
      ELSIF vNum = 6 then
         dbms_output.put_line(vString||CHR(i)||' : '||i);
         vNum := 0;
         vString := '';
      ELSE
         dbms_output.put_line('ERROR');
      END IF;
   END LOOP;
   dbms_output.put_line(vString);

   --
   -- Formatted chars less than 'a' to ASCII values
   --
   vString := '';
   vNum := 0;

   dbms_output.new_line;
   dbms_output.new_line;
   dbms_output.put_line('Formatted Letters, less than a  to ASCII values');
   dbms_output.put_line('-------------------------------------------------------');
   FOR i in 0 .. ASCII('a')-1 LOOP
      IF vNum < 6 THEN
         vString := vString||CHR(i)||' : '||i||vTab;
         vNum := vNum + 1;
      ELSIF vNum = 6 then
         dbms_output.put_line(vString||CHR(i)||' : '||i);
         vNum := 0;
         vString := '';
      ELSE
         dbms_output.put_line('ERROR');
      END IF;
   END LOOP;
   dbms_output.put_line(vString);

   --
   -- Formatted chars greater than 'Z' to ASCII values
   --
   vNum := 0;
   vString := '';

   dbms_output.new_line;
   dbms_output.new_line;
   dbms_output.put_line('Formatted Letters, greater than z  to ASCII values');
   dbms_output.put_line('-------------------------------------------------------');
   FOR i IN ASCII('z') .. ASCII('z')+133 LOOP
      IF vNum < 6 THEN
         vString := vString||CHR(i)||' : '||i||vTab;
         vNum := vNum + 1;
      ELSIF vNum = 6 then
         dbms_output.put_line(vString||CHR(i)||' : '||i);
         vNum := 0;
         vString := '';
      ELSE
         dbms_output.put_line('ERROR');
      END IF;
   END LOOP;
   dbms_output.put_line(vString);

END;
/

 

결과값은 아래와 같이 출력된다.

 

=======================================================================================

Formatted Lower Case Letters to ASCII values
-------------------------------------------------------
a : 97  b : 98  c : 99  d : 100 e : 101 f : 102 g : 103
h : 104 i : 105 j : 106 k : 107 l : 108 m : 109 n : 110
o : 111 p : 112 q : 113 r : 114 s : 115 t : 116 u : 117
v : 118 w : 119 x : 120 y : 121 z : 122


Formatted Upper Case Letters to ASCII values
-------------------------------------------------------
A : 65  B : 66  C : 67  D : 68  E : 69  F : 70  G : 71
H : 72  I : 73  J : 74  K : 75  L : 76  M : 77  N : 78
O : 79  P : 80  Q : 81  R : 82  S : 83  T : 84  U : 85
V : 86  W : 87  X : 88  Y : 89  Z : 90


Formatted Letters, less than a  to ASCII values
-------------------------------------------------------
  : 0    : 1     : 2     : 3     : 4     : 5     : 6
 : 7    : 8              : 9
 : 10
         : 11
 : 13            : 12
 : 14    : 15    : 16    : 17    : 18    : 19    : 20
 : 21    : 22    : 23    : 24    : 25    : 26   : 27
 : 28    : 29    : 30    : 31     : 32  ! : 33  " : 34
# : 35  $ : 36  % : 37  & : 38  ' : 39  ( : 40  ) : 41
* : 42  + : 43  , : 44  - : 45  . : 46  / : 47  0 : 48
1 : 49  2 : 50  3 : 51  4 : 52  5 : 53  6 : 54  7 : 55
8 : 56  9 : 57  : : 58  ; : 59  < : 60  = : 61  > : 62
? : 63  @ : 64  A : 65  B : 66  C : 67  D : 68  E : 69
F : 70  G : 71  H : 72  I : 73  J : 74  K : 75  L : 76
M : 77  N : 78  O : 79  P : 80  Q : 81  R : 82  S : 83
T : 84  U : 85  V : 86  W : 87  X : 88  Y : 89  Z : 90
[ : 91  \ : 92  ] : 93  ^ : 94  _ : 95  ` : 96


Formatted Letters, greater than z  to ASCII values
-------------------------------------------------------
z : 122 { : 123 | : 124 } : 125 ~ : 126  : 127   : 128
 : 129   : 130   : 131   : 132   : 133   : 134   : 135
 : 136   : 137   : 138   : 139   : 140   : 141   : 142
 : 143   : 144   : 145   : 146   : 147   : 148   : 149
 : 150   : 151   : 152   : 153   : 154   : 155   : 156
 : 157   : 158   : 159   : 160   : 161   : 162   : 163
 : 164   : 165   : 166   : 167   : 168   : 169   : 170
 : 171   : 172   : 173   : 174   : 175   : 176   : 177
 : 178   : 179   : 180   : 181   : 182   : 183   : 184
 : 185   : 186   : 187   : 188   : 189   : 190   : 191
 : 192   : 193   : 194   : 195   : 196   : 197   : 198
 : 199   : 200   : 201   : 202   : 203   : 204   : 205
 : 206   : 207   : 208   : 209   : 210   : 211   : 212
 : 213   : 214   : 215   : 216   : 217   : 218   : 219
 : 220   : 221   : 222   : 223   : 224   : 225   : 226
 : 227   : 228   : 229   : 230   : 231   : 232   : 233
 : 234   : 235   : 236   : 237   : 238   : 239   : 240
 : 241   : 242   : 243   : 244   : 245   : 246   : 247
 : 248   : 249   : 250   : 251   : 252   : 253   : 254
 : 255

Posted by pat98

- 일자별 log switch 개수


select v2.DAY "DATE(Recent 15 Days)" , NVL(LOG_CNT,0) "Switch Count"

from

        (select to_char(first_time,'YYYY-MM-DD') DAY,count(*) LOG_CNT

         from V$LOG_HISTORY

         group by to_char(first_time,'YYYY-MM-DD')) v1,

        (select to_char((sysdate - 15),'YYYY-MM-DD') DAY from dual   union all    

         select to_char((sysdate - 14),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate - 13),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate - 12),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate - 11),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate - 10),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  9),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  8),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  7),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  6),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  5),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  4),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  3),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  2),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  1),'YYYY-MM-DD') DAY from dual) v2

where v1.DAY(+) = v2.DAY 

order by 1;


- 시간별 log switch 개수


select v2.Time || ' H' Time , NVL(LOG_CNT,0) SwitchCount

from (select to_char(first_time,'HH24') Time,count(*) LOG_CNT

          from V$LOG_HISTORY

         group by to_char(first_time,'HH24'))  v1,

        (select '00' Time from dual   union all    select '01' Time from dual  union all         

         select '02' Time from dual   union all    select '03' Time from dual  union all

         select '04' Time from dual   union all    select '05' Time from dual  union all

         select '06' Time from dual   union all    select '07' Time from dual  union all

         select '08' Time from dual   union all    select '09' Time from dual  union all

         select '10' Time from dual   union all    select '11' Time from dual  union all

         select '12' Time from dual   union all    select '13' Time from dual  union all

         select '14' Time from dual   union all    select '15' Time from dual  union all

         select '16' Time from dual   union all    select '17' Time from dual  union all

         select '18' Time from dual   union all    select '19' Time from dual  union all

         select '20' Time from dual   union all    select '21' Time from dual  union all

         select '22' Time from dual   union all    select '23' Time from dual  union all

         select '24' Time from dual   ) v2

where v1.Time(+) = v2.Time  

order by 1;



- 일별 로그생성 사이즈 (15일간)


set linesize 120

col v2.DAY for A20

col LOG_SIZE for A15


select v2.DAY "DATE (for 15 Days)" , NVL(LOG_SIZE,'-') "Archived Size" 

from

        (select to_char(COMPLETION_TIME,'YYYY-MM-DD') DAY,

                to_char(round(sum((BLOCKS * BLOCK_SIZE)/(1024*1024)),1)) || ' MB' LOG_SIZE

         from v$archived_log

         group by to_char(COMPLETION_TIME,'YYYY-MM-DD')) v1,

        (select to_char((sysdate - 15),'YYYY-MM-DD') DAY from dual   union all    

         select to_char((sysdate - 14),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate - 13),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate - 12),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate - 11),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate - 10),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  9),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  8),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  7),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  6),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  5),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  4),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  3),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  2),'YYYY-MM-DD') DAY from dual   union all

         select to_char((sysdate -  1),'YYYY-MM-DD') DAY from dual) v2

where v1.DAY(+) = v2.DAY 

order by 1;



- 시간대별 로그생성 크기


select v2.Time || ' H'  Time , NVL(LOG_SIZE,'-') SwitchCount

from 

         (select to_char(COMPLETION_TIME,'HH24') Time,

                 to_char(round(sum((BLOCKS * BLOCK_SIZE)/(1024*1024)),1)) || ' MB' LOG_SIZE

         from v$archived_log

         group by to_char(COMPLETION_TIME,'HH24'))  v1,

        (select '00' Time from dual   union all    select '01' Time from dual  union all         

         select '02' Time from dual   union all    select '03' Time from dual  union all

         select '04' Time from dual   union all    select '05' Time from dual  union all

         select '06' Time from dual   union all    select '07' Time from dual  union all

         select '08' Time from dual   union all    select '09' Time from dual  union all

         select '10' Time from dual   union all    select '11' Time from dual  union all

         select '12' Time from dual   union all    select '13' Time from dual  union all

         select '14' Time from dual   union all    select '15' Time from dual  union all

         select '16' Time from dual   union all    select '17' Time from dual  union all

         select '18' Time from dual   union all    select '19' Time from dual  union all

         select '20' Time from dual   union all    select '21' Time from dual  union all

         select '22' Time from dual   union all    select '23' Time from dual  union all

         select '24' Time from dual   ) v2

where v1.Time(+) = v2.Time  

order by 1;


- 시간대별 archive 발생량 확인


alter session set nls_date_format = 'YYYY-MM-DD HH24';

SELECT TRUNC(COMPLETION_TIME, 'HH') ARCHIVED_DATE_HOUR,

            SUM(BLOCKS * BLOCK_SIZE) / 1024 / 1024 SIZE_IN_MB

       FROM V$ARCHIVED_LOG

      GROUP BY TRUNC(COMPLETION_TIME, 'HH')

      ORDER BY 1;


- 시간대별 archive 발생량 확인 (per instance별)


SELECT

            TRUNC(COMPLETION_TIME) ARCHIVED_DATE,

            THREAD#,

            SUM(BLOCKS * BLOCK_SIZE) / 1024 / 1024 SIZE_IN_MB

       FROM V$ARCHIVED_LOG

      GROUP BY TRUNC(COMPLETION_TIME), THREAD#

      ORDER BY 1, 2;



- 일일 아카이브 발생량 및 삭제량


SELECT SUM_ARCH.DAY,

         SUM_ARCH.GENERATED_MB,

         SUM_ARCH_DEL.DELETED_MB,

         SUM_ARCH.GENERATED_MB - SUM_ARCH_DEL.DELETED_MB "REMAINING_MB"

    FROM (  SELECT TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY') DAY,

                   SUM (ROUND ( (blocks * block_size) / (1024 * 1024 * 1024), 2))

                      GENERATED_MB

              FROM V$ARCHIVED_LOG

             WHERE ARCHIVED = 'YES'

          GROUP BY TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY')) SUM_ARCH,

         (  SELECT TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY') DAY,

                   SUM (ROUND ( (blocks * block_size) / (1024 * 1024 * 1024), 2))

                      DELETED_MB

              FROM V$ARCHIVED_LOG

             WHERE ARCHIVED = 'YES' AND DELETED = 'YES'

          GROUP BY TO_CHAR (COMPLETION_TIME, 'DD/MM/YYYY')) SUM_ARCH_DEL

   WHERE SUM_ARCH.DAY = SUM_ARCH_DEL.DAY(+)

ORDER BY TO_DATE (DAY, 'DD/MM/YYYY');


- 시간별 발생량 확인


set pages 1000 

alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';

select trunc(COMPLETION_TIME,'HH') Hour,thread# , 

round(sum(BLOCKS*BLOCK_SIZE)/1024/1024/1024) GB,

count(*) Archives from v$archived_log 

group by trunc(COMPLETION_TIME,'HH'),thread#  order by 1 ;



Posted by pat98

01-27 18:28
Flag Counter
Yesterday
Today
Total

글 보관함

최근에 올라온 글

달력

 « |  » 2025.1
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

최근에 달린 댓글