'oracle'에 해당되는 글 15건

  1. 2014.11.01 recovery 이론 및 dump파일 내용
  2. 2014.10.26 control file 다중화 실습
  3. 2014.10.26 oracle의 시작단계
  4. 2014.10.15 sql 시험
  5. 2014.10.14 plsql cursor 연습문제 정답
2014. 11. 1. 01:58

dump file이 저장될 장소를 확인하는 명령어


SYS>show parameter user_dump_dest;


NAME                                 TYPE        VALUE

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

user_dump_dest                       string      /app/oracle/diag/rdbms/testdb/testdb/trace



위 trace 경로에는 많은 파일이 있어서 생성되어도 찾기가 어려움

그래서 구분하기 쉽게 identifier을 추가한 후 dump를 수행함


SYS>alter session set tracefile_identifier='AAA';

Session altered.


SYS>oradebug setmypid;

Statement processed.


SYS>oradebug dump controlf 3;

Statement processed.



SYS>!

[oracle@localhost ~]$ cd /app/oracle/diag/rdbms/testdb/testdb/trace/

[oracle@localhost trace]$ ls -lSh *AAA*

-rw-r----- 1 oracle oinstall 44K Nov  1 00:33 testdb_ora_4412_AAA.trc

-rw-r----- 1 oracle oinstall 169 Nov  1 00:33 testdb_ora_4412_AAA.trm


컨트롤 파일 dump가 완성됨

968줄이나 됨.

복구와 관련된 내용만 살펴보자.



[oracle@localhost trace]$ vi testdb_ora_4412_AAA.trc

Trace file /app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_4412_AAA.trc

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production

With the Partitioning option

ORACLE_HOME = /app/oracle/product/11g

System name:    Linux

Node name:      localhost.localdomain

Release:        2.6.18-238.el5

Version:        #1 SMP Tue Jan 4 15:24:05 EST 2011

Machine:        i686

VM name:        VMWare Version: 6

Instance name: testdb

Redo thread mounted by this instance: 1

Oracle process number: 19

Unix process pid: 4412, image: oracle@localhost.localdomain (TNS V1-V3)


... 중간 생략 ...


*** 2014-11-01 00:22:07.177

*** SESSION ID:(1.5) 2014-11-01 00:22:07.177

*** CLIENT ID:() 2014-11-01 00:22:07.177

*** SERVICE NAME:(SYS$USERS) 2014-11-01 00:22:07.177

*** MODULE NAME:(sqlplus@localhost.localdomain (TNS V1-V3)) 2014-11-01 00:22:07.177

*** ACTION NAME:() 2014-11-01 00:22:07.177


***************************************************************************

DATABASE ENTRY

***************************************************************************

 (size = 316, compat size = 316, section max = 1, section in-use = 1,

  last-recid= 0, old-recno = 0, last-recno = 0)

 (extent = 1, blkno = 1, numrecs = 1)

 09/27/2014 13:35:14

 DB Name "TESTDB"                     DATABASE NAME 임

 Database flags = 0x00404001 0x00001200

 Controlfile Creation Timestamp  09/27/2014 13:35:15

 Incmplt recovery scn: 0x0000.00000000

 Resetlogs scn: 0x0000.000bc19f Resetlogs Timestamp  09/27/2014 13:35:17

 Prior resetlogs scn: 0x0000.00000001 Prior resetlogs Timestamp  09/05/2010 15:39:48

 Redo Version: compatible=0xb200000

 #Data files = 5, #Online files = 5

 Database checkpoint: Thread=1 scn: 0x0000.0014161e   DATABASE 전체의 Chekcpoint SCN

 Threads: #Enabled=1, #Open=1, Head=1, Tail=1

 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000

 

... 중간 생략 ...


***************************************************************************
LOG FILE RECORDS 복구에 필요한 Redo Log File 관련 내용
***************************************************************************
 (size = 72, compat size = 72, section max = 16, section in-use = 3,
  last-recid= 3, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 10, numrecs = 16)
LOG FILE #1:
  name #3: /app/oracle/oradata/testdb/redo01.log     1번 그룹의 파일 경로
 Thread 1 redo log links: forward: 2 backward: 0
 siz: 0x19000 seq: 0x00000016 hws: 0xd bsz: 512 nab: 0x18247 flg: 0x1 dup: 1
 Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00132247
 Low scn: 0x0000.00137883 10/26/2014 16:59:37
 Next scn: 0x0000.00139a51 10/26/2014 21:04:30
LOG FILE #2:
  name #2: /app/oracle/oradata/testdb/redo02.log        2번 그룹의 파일 경로
 Thread 1 redo log links: forward: 3 backward: 1
 siz: 0x19000 seq: 0x00000017 hws: 0xd bsz: 512 nab: 0x108a8 flg: 0x1 dup: 1
 Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00137883
 Low scn: 0x0000.00139a51 10/26/2014 21:04:30
 Next scn: 0x0000.0014161d 10/31/2014 23:27:36
LOG FILE #3:
  name #1: /app/oracle/oradata/testdb/redo03.log        3번 그룹의 파일 경로
 Thread 1 redo log links: forward: 0 backward: 2
 siz: 0x19000 seq: 0x00000018 hws: 0x2 bsz: 512 nab: 0xffffffff flg: 0x8 dup: 1
 Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00139a51
 Low scn: 0x0000.0014161d 10/31/2014 23:27:36
 Next scn: 0xffff.ffffffff 01/01/1988 00:00:00


***************************************************************************
DATA FILE RECORDS        Data file 관련 내용
***************************************************************************
 (size = 520, compat size = 520, section max = 100, section in-use = 5,
  last-recid= 38, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 11, numrecs = 100)
DATA FILE #1:
  name #7: /app/oracle/oradata/testdb/system01.dbf
creation size=0 block size=8192 status=0xe head=7 tail=7 dup=1
 tablespace 0, index=1 krfil=1 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:139 scn: 0x0000.0014161e 10/31/2014 23:27:36
 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19
 Creation Checkpointed at scn:  0x0000.00000007 09/05/2010 15:39:53
 thread:0 rba:(0x0.0.0)



데이터 파일안에는 두가지 scn이 있음


ckeckpoint cnt : 현재 데이터 파일에 저장 되어 있는 scn 번호
stop scn : 추가로 작업이 진행될 때 추가되는 scn을 의미

현재까지 저장완료된 scn은 몇 번인지 알 수 있지만,
신규로 추가되는 scn은 현재 작업 중이기 때문에 몇 번까지 들어올지 모름

-> 오라클 DB가 open 상태이면, stop scn을 임시로 무한대(0xffff.fffffff)로 설정해둠
    DB 정상종료가되거나 OFFLINE  되는 경우에 
    checkpoint 를 발생시켜 checkpoint scn / stop scn을 동일하게 만들고 해당 데이터 파일을 닫음

만약에 운영 중 DB가 장애가 생겨서 shutdown abort 된 상황
- checkpoint scn / stop scn의 값이 동기화 되지 않은 상황에서 종료


... 중간 생략 ...


 Hot Backup end marker scn: 0x0000.00000000

 aux_file is NOT DEFINED

 Plugged readony: NO

 Plugin scnscn: 0x0000.00000000

 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Online move state: 0

DATA FILE #2:

  name #6: /app/oracle/oradata/testdb/sysaux01.dbf

creation size=0 block size=8192 status=0xe head=6 tail=6 dup=1

 tablespace 1, index=2 krfil=2 prev_file=0

 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00

 Checkpoint cnt:139 scn: 0x0000.0014161e 10/31/2014 23:27:36

 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19

 Creation Checkpointed at scn:  0x0000.00000883 09/05/2010 15:39:57

 thread:0 rba:(0x0.0.0)

 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000


... 중간 생략 ...


 Hot Backup end marker scn: 0x0000.00000000

 aux_file is NOT DEFINED

 Plugged readony: NO

 Plugin scnscn: 0x0000.00000000

 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Online move state: 0

DATA FILE #3:

  name #5: /app/oracle/oradata/testdb/undotbs01.dbf

creation size=0 block size=8192 status=0xe head=5 tail=5 dup=1

 tablespace 2, index=3 krfil=3 prev_file=0

 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00

 Checkpoint cnt:67 scn: 0x0000.0014161e 10/31/2014 23:27:36

 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19

 Creation Checkpointed at scn:  0x0000.000bb6b4 09/05/2010 16:17:54

 thread:0 rba:(0x0.0.0)

 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000


... 중간 생략 ...


 Hot Backup end marker scn: 0x0000.00000000
 aux_file is NOT DEFINED
 Plugged readony: NO
 Plugin scnscn: 0x0000.00000000
 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Online move state: 0
DATA FILE #4:
  name #4: /app/oracle/oradata/testdb/users01.dbf
creation size=0 block size=8192 status=0xe head=4 tail=4 dup=1
 tablespace 4, index=4 krfil=4 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:138 scn: 0x0000.0014161e 10/31/2014 23:27:36
 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19
 Creation Checkpointed at scn:  0x0000.000049c6 09/05/2010 15:40:06
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000

... 중간 생략 ...


 Hot Backup end marker scn: 0x0000.00000000

 aux_file is NOT DEFINED

 Plugged readony: NO

 Plugin scnscn: 0x0000.00000000

 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Online move state: 0

DATA FILE #5:

  name #9: /app/oracle/oradata/testdb/example01.dbf

creation size=12800 block size=8192 status=0xe head=9 tail=9 dup=1

 tablespace 6, index=6 krfil=5 prev_file=0

 unrecoverable scn: 0x0000.00141a59 10/31/2014 23:27:50

 Checkpoint cnt:63 scn: 0x0000.0014161e 10/31/2014 23:27:36

 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19

 Creation Checkpointed at scn:  0x0000.000c2efc 09/27/2014 13:37:19

 thread:1 rba:(0x1.b3fa.10)

 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000


... 중간 생략 ...


***************************************************************************
TEMP FILE RECORDS
***************************************************************************
 (size = 56, compat size = 56, section max = 100, section in-use = 1,
  last-recid= 10, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 90, numrecs = 100)
TEMP FILE #1: External File #201
  name #8: /app/oracle/oradata/testdb/temp01.dbf
creation size=2560 block size=8192 status=0x1e head=8 tail=8 dup=1
 tablespace 3, index=5 krfil=1 prev_file=0
 unrecoverable scn: 0x0000.000bc288 09/27/2014 13:35:35




'DB > oralce' 카테고리의 다른 글

ora-01190  (0) 2014.11.04
archive log mode 아카이브 로그 모드 장애 복구  (0) 2014.11.03
오라클이 시작되는 원리  (0) 2014.10.31
오라클 실습시 용량부족으로 디스크 붙이는 방법  (0) 2014.10.31
backup  (0) 2014.10.30
Posted by 성장하는yw
2014. 10. 26. 22:01

1 컨트롤 파일 / 다중화 의미

- control file :  오라클 서버를 운영하는데 필수적인 정보들이 저장되어 있음

                       instance가 mount 이상의 상태일 때부터 실시간으로 control file의 내용이 변경, 조회됨

                       이 파일이 깨지면 DB가 망가짐

                       파일삭제 등 문제가 생기더라도 복구 할 수 있도록 복사본을 만들어 분산시켜 저장함 (multiplexing 다중화)


2. 작동 순서와 다중화 하는 방법

- 작동순서

startup - parameter file 읽어서 control file의 위치 확인 - control file을 메모리로 불러와 내용 확인 


- 다중화하는 방법 

parameter file에 control file의 위치를 기록한 후 그 경로에  control file을 복사하면 다중화가 됨 


* spfile 일 경우 다중화하는 방법


- 실습예제 

현재 운영중인 control file의 경로 확인 후

/home/oracle/disk1/control01.ctl

/home/oracle/disk2/control02.ctl

/home/oracle/disk3/controlo03.ctl 로 다중화(복사)


- 하는 순서

1. DB 상태 확인

2. 현재 운영중인 control file의 경로 확인

3. spfile경로 변경

4. instance 종료

5. 대상 디렉토리 생성 및 컨트롤 파일을 spfile 수정한 경로로 생성

6. instance  open -> startup


간략히 

spfile의 내용 변경 -> instance 종료 -> control file 복사 -> instance open


- 과정

현재 db 상태 확인

SYS>select status from v$instance;


STATUS

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

OPEN


spfile 인지 pfile 인지 확인

SYS>show parameter spfile;


NAME     TYPE VALUE

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

spfile     string /app/oracle/product/11g/dbs/sp

filetestdb.ora


한 화면에 보기 위해서 칼럼 크기 조정
SYS>col name for a70

control file의 현재경로 조회
SYS>select name from v$controlfile;

NAME
----------------------------------------------------------------------
/app/oracle/oradata/testdb/control01.ctl
/home/oracle/fast_recovery_area/testdb/control02.ctl

spfile안에 기록 되어있는 control file의 경로 변경
SYS>alter system set control_files='/home/oracle/disk1/control01.ctl',
  2  '/home/oracle/disk2/control02.ctl',
  3  '/home/oracle/disk3/control03.ctl' scope=spfile;

System altered.

db instance 종료
SYS>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

sqlplus을 종료하지 않고 터미널창(리눅스커맨드창)으로 이동
SYS>!
[oracle@localhost ~]$ cd /home/oracle
디렉토리 생성
[oracle@localhost ~]$ mkdir disk1 disk2 disk3



spfile 변경 경로에 컨트롤 파일을 복사해 옴
[oracle@localhost ~]$ cp /app/oracle/oradata/testdb/control01.ctl /home/oracle/disk1/control01.ctl
[oracle@localhost ~]$ cp /app/oracle/oradata/testdb/control01.ctl /home/oracle/disk2/control02.ctl
[oracle@localhost ~]$ cp /app/oracle/oradata/testdb/control01.ctl /home/oracle/disk3/control03.ctl

*컨트롤 파일은 여러 곳에 분산이 되어도 내용은 모두 동일해야함
그래서 아래 처럼 control01을 3곳으로 이름을 바꾸어서 복사를 해도 아무런 문제가 없음

리눅스 명령창에서 나와서 sqlplus로 이동
[oracle@localhost ~]$ exit
exit

db instance 시작
SYS>startup
ORACLE instance started.

Total System Global Area  422670336 bytes
Fixed Size    1344616 bytes
Variable Size  322964376 bytes
Database Buffers   92274688 bytes
Redo Buffers    6086656 bytes
Database mounted.
Database opened.

변경된 컨트롤 파일 경로 확인
SYS>select name from v$controlfile;

NAME
----------------------------------------------------------------------
/home/oracle/disk1/control01.ctl
/home/oracle/disk2/control02.ctl
/home/oracle/disk3/control03.ctl



* pfile 일 경우 다중화하는 방법


현재 spfile을 사용하는 상태 -> pfile 생성 -> spfile 삭제 -> instance 재시작 후 다중화 작업을 함

조회한 컨트롤 파일 위치를 아래 경로로 다중화

/home/oracle/disk4/control01.ctl

/home/oracle/disk5/control01.ctl

/home/oracle/disk6/control01.ctl


SYS>!ls $ORACLE_HOME/dbs

hc_DBUA0.dat  hc_testdb.dat  init.ora  lkTESTDB  orapwtestdb  spfiletestdb.ora


SYS>create pfile from spfile;


File created.


SYS>!rm -f $ORACLE_HOME/dbs/spfiletestdb.ora


SYS>!ls $ORACLE_HOME/dbs

hc_DBUA0.dat  hc_testdb.dat  init.ora  inittestdb.ora  lkTESTDB  orapwtestdb


SYS>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS>startup

ORACLE instance started.


Total System Global Area  422670336 bytes

Fixed Size    1344616 bytes

Variable Size  322964376 bytes

Database Buffers   92274688 bytes

Redo Buffers    6086656 bytes

Database mounted.

Database opened.


pfil 확인, 아래 조회내용에서 value 부분에 아무것도 나오지 않으면 pfile

SYS>show parameter pfile;


NAME     TYPE VALUE

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

spfile     string


SYS>select name from v$controlfile;


NAME

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

/home/oracle/disk1/control01.ctl

/home/oracle/disk2/control02.ctl

/home/oracle/disk3/control03.ctl


SYS>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.


SYS>!vi $ORACLE_HOME/dbs/inittestdb.ora

testdb.__db_cache_size=92274688

testdb.__java_pool_size=4194304

testdb.__large_pool_size=4194304

testdb.__oracle_base='/app/oracle'#ORACLE_BASE set from environment

testdb.__pga_aggregate_target=155189248

testdb.__sga_target=268435456

testdb.__shared_io_pool_size=0

testdb.__shared_pool_size=159383552

testdb.__streams_pool_size=0

*.audit_file_dest='/app/oracle/admin/testdb/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'


주석처리 한 부분을 파란색 글씨처럼 원하는 경로로 수정해줌

#*.control_files='/home/oracle/disk1/control01.ctl','/home/oracle/disk2/control02.ctl','/home/oracle/disk3/control03.ctl'

*.control_files='/home/oracle/disk4/control01.ctl','/home/oracle/disk5/control02.ctl','/home/oracle/disk6/control03.ctl'


*.db_block_size=8192

*.db_domain=''

*.db_name='testdb'

*.db_recovery_file_dest='/home/oracle/fast_recovery_area'

*.db_recovery_file_dest_size=4196401152

*.diagnostic_dest='/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=testdbXDB)'

*.log_archive_format='%t_%s_%r.dbf'

*.memory_target=422576128

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'

~                                                                                                                  

~                                                                                                                  

~                                                                                                                  

~                                                                                                                  

~                                                                                                                  

~                                                                                                                  

~                                                                                                                  

~                                                                                                                  

~                                                                                                                  

"/app/oracle/product/11g/dbs/inittestdb.ora" 26L, 950C


:wq!


SYS>!

[oracle@localhost ~]$ cd /home/oracle

[oracle@localhost ~]$ mkdir disk4 disk5 disk6

[oracle@localhost ~]$ cp /home/oracle/disk1/control01.ctl /home/oracle/disk4/control01.ctl

[oracle@localhost ~]$ cp /home/oracle/disk1/control01.ctl /home/oracle/disk5/control02.ctl

[oracle@localhost ~]$ cp /home/oracle/disk1/control01.ctl /home/oracle/disk6/control03.ctl

[oracle@localhost ~]$ exit

exit


SYS>startup

ORACLE instance started.


Total System Global Area  422670336 bytes

Fixed Size    1344616 bytes

Variable Size  322964376 bytes

Database Buffers   92274688 bytes

Redo Buffers    6086656 bytes

Database mounted.

Database opened.

SYS>select name from v$controlfile;


NAME

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

/home/oracle/disk4/control01.ctl

/home/oracle/disk5/control02.ctl

/home/oracle/disk6/control03.ctl



pfile을 사용, 컨트롤파일을 다중화 하는 경우는 복사하고 경로를 수정해줘도 전혀 문제가 없지만

spfile일 때, 나머지 과정들은 꼭 순서대로 해야만 한다. 

장애 생김


컨트롤 파일에 변경되는 정보가 실시간으로 저장 되기 때문에 가장 최근에 사용한 것만 진짜 컨트롤 파일이고 

나머지 컨트롤 파일은 예전파일로 변한다. 

이동이나 복사를 할 때, 가장 최근에 사용했던것만 사용해야 한다.

'DB > oralce' 카테고리의 다른 글

dbms_job / dbms_scheduler  (0) 2014.10.27
사용자관리  (0) 2014.10.27
oracle의 시작단계  (0) 2014.10.26
3 oracle background processes  (0) 2014.10.24
9 메모리 관리 기법  (0) 2014.10.24
Posted by 성장하는yw
2014. 10. 26. 20:56

1. 오라클의 시작단계





* 사용 중인 파일은 절대로 이동 및 복사를 하면 안된다.(DB깨짐)

   단, parameter file 중에 pfile은 예외


* 어떤 작업을 하느냐에 따라 시작되는 단계가 다르다.

   원하는 단계까지만 실행 후 db open을 하려면 alter database 라는 명령어를 사용.

   반드시 startup-nomount-mount-open 단계를 순서대로 거쳐야 함

   예) nomount->open 할 때, mount를 건너뛰고 바로 open 상태로 갈 수 없음


실습1

nomount 단계까지만 시작한 후 나머지 단계 진행하기


SYS>startup nomount;

ORACLE instance started.


Total System Global Area  422670336 bytes

Fixed Size                  1344616 bytes

Variable Size             322964376 bytes

Database Buffers           92274688 bytes

Redo Buffers                6086656 bytes

SYS>alter database mount;


Database altered.


SYS>alter database open;


Database altered.


실습2

mount 단계까지만 시작한 후 나머지 단계 진행하기


SYS>startup mount;
ORACLE instance started.

Total System Global Area  422670336 bytes
Fixed Size                  1344616 bytes
Variable Size             322964376 bytes
Database Buffers           92274688 bytes
Redo Buffers                6086656 bytes
aDatabase mounted.
SYS>lter database open;

Database altered.

실습3

읽기 전용인 상태로 open 하기


select 작업만 가능한 상태로 open : 감사 작업과 같이 데이터 변경이 안되고 조회만 가능한 상태임


read only 모드로 open 후에 다시 데이터 변경이 가능하도록 하려면 instance 종료 후 다시 시작하면 됨 


SYS>startup mount;

ORACLE instance started.


Total System Global Area  422670336 bytes

Fixed Size                  1344616 bytes

Variable Size             322964376 bytes

Database Buffers           92274688 bytes

Redo Buffers                6086656 bytes

Database mounted.

SYS>alter database open read only;


Database altered.


실습4
제한된 모드(restricted mode)로 open 하기

허락받은 계정(grant 명령어를 사용)만 데이터의 생성이나 수정이 가능한 상태
제품 유지관리 작업시에 주로 사용

DB가 꺼져있을 때 이 모드로 들어가는 방법은 아래와 같음

SYS>startup restrict;
ORACLE instance started.

Total System Global Area  422670336 bytes
Fixed Size                  1344616 bytes
Variable Size             322964376 bytes
Database Buffers           92274688 bytes
Redo Buffers                6086656 bytes
Database mounted.
Database opened.

DB가 open상태 일 때 제한된 모드(restricted mode)로 변경하기


SYS>select status from v$instance;    db 현재 상태 조회


STATUS

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

OPEN


SYS>alter system enable restricted session;    제한된 모드 사용


System altered.


SYS>alter system disable restricted session;    제한된 모드 사용안 함


System altered.


제한된 모드로 open된 instance에 접속하려면 restricted session 라는 권한을 가지고 있어야만 함


 

'DB > oralce' 카테고리의 다른 글

사용자관리  (0) 2014.10.27
control file 다중화 실습  (0) 2014.10.26
3 oracle background processes  (0) 2014.10.24
9 메모리 관리 기법  (0) 2014.10.24
6 redo log 관리하기  (0) 2014.10.21
Posted by 성장하는yw
2014. 10. 15. 20:39

1.panmae테이블을 사용하여 아래와 같이 출력하세요





2.

3장 그룹함수 35p

professor 테이블에서 각 교수들의 급여를 구하고 각 교수의 급여액이 전체 교수의 급여 합계에서 차지하는 비율을 출력





5장 ddl


emp 테이블에서 empno, ename, sal 컬럼을 가져와 

emp10 이름으로 테이블 생성, 

데이터는 가져오지 않도록 하는 쿼리문



4

5장 ddl 13p


test10 테이블에 address 컬럼을 추가하는 쿼리

address는 varchar2(30) 이고, 기본값으로 "서울"이 자동입력 되도록 한다.




5장 ddl 13p


4번에서 만든 address 컬럼의 이름을 location 으로 변경하는 쿼리




6

7장 제약조건 4p


emp4 테이블의  no 컬럼이  emp2 테이블의  empno 컬럼의 값을 참조하도록 참조키 제약조건을 

설정하세요.(emp4 테이블이 자식테이블입니다)



7

7장 제약조건 14p


test10  테이블의 name 컬럼에 만들어져 있는 unique 제약조건을 사용안함으로 변경,

또, 해당테이블의 데이터에 DML 명령도 실행되지 않도록 변경하는 쿼리

(제약조건 이름은 test10_name_uk 입니다)




8

7장 제약조건 19~20p


7번에서 사용 안 함으로 설정한 제약조건을 사용함으로 변경,

기존에 있던 내용과 새로 들어올 내용 모두를 체크하는 옵션으로 변경하세요

그리고 문제가 되는 데이터들은 sys.exceptions 테이블에 저장하도록 하세요



9

7장 제약조건 25p


emp테이블에 설정되어 있는 제약조건 중 자신이 생성한 제약 조건들을 

테이블명, 컬럼명, 제약조건명으로 검색하는 쿼리를 쓰세요



10

3장 복수행함수 38p


emp 테이블의 hiredate 컬럼을 참조, 아래와 같이 월별로 입사인원수를 출력하세요





11

3장 복수행함수 38p





12

3장 복수행함수 38p







13

3장 복수행함수 41p




14

3장 복수행함수 40p





15

9장 view 9p 인라인뷰

 





16

9장 view 10p 인라인뷰






17

9장 view 16p 연습문제




18

9장 view  연습문제 5번




19

10장 subquery 7p






20

10장 sub query 9p




21

11장 sequence와 synonym1~2p




22

7장 제약조건 3p


아래 조건에 만족하는 테이블을 생성하세요

*테이블 이름은 emp3

*no 컬럼은 number 4로 하고 primary key 이며

 제약조건명은 emp3_no_pk로 하세요

*name 컬럼은 varchar2 10바이트로 하고 not null로 설정하고

제약조건명은 emp3_name_nn 으로 하세요

*deptno 컬럼은 varchar2(6)으로 하고

deptno 테이블의 dcode 컬럼을 참조하는 foreign key로 설정하세요




23

11장 sequence와 synonym12p - 시너님 관련


Scott 사용자의 department 테이블의 동의어를 d2 로 생성하되 

모든 사용자들이 사용할 수 있도록 생성하세요

(Scott 사용자가 동의어를 생성할 수 있도록 권한도 없다고 가정하고 권한도 부여하세요)





24

2장 단일행함수 45p





25

2장 단일행함수 56p 정규식함수


reg_test 테이블에서 소문자가 들어있는 모든 행을 제거한 후 아래와 같이 표현하세요




26

2장 단일행함수 60p


reg_test 테이블에서 ? 가 들어있는 모든 행을 아래와 같이 출력하세요




27

2장 단일행함수 65p 정규식부분

맨 아래예제 변형문제


reg_test2 테이블에서 ip주소에서 두번째 .을 *로 바꾸어 출력하세요





28

2장 단일행함수 67p


사용자로 부터 id 값을 입력 받은 후 student 테이블에서 studno, name, id 를 출력하되

입력된 id 값은 ' 75 TRUE(첫 글자 공백과 가운데 공백, 대문자) 로 입력했을 때

공백을 모두 제거하고, 영어는 소문자로 변환해 조회하는 쿼리를 쓰세요



29

2장 단일행함수 71p 정규식 부분


교수테이블(professor )테이블에서 홈페이지(hpage) 주소가 있는 교수들만 조사해서 아래의 화면

처럼 나오게 출력하세요.






30


12장 계층형 쿼리 8p




'DB > oralce' 카테고리의 다른 글

4 oracle 시작하기와 종료하기  (0) 2014.10.20
오라클 관리실무  (0) 2014.10.17
2장 내가 못푼 쿼리문 - 설명을 덧붙일 것  (0) 2014.10.15
계층형쿼리  (0) 2014.10.14
plsql cursor 연습문제 정답  (0) 2014.10.14
Posted by 성장하는yw
2014. 10. 14. 15:08

1번 문제 



2번 문제



3번 문제



'DB > oralce' 카테고리의 다른 글

2장 내가 못푼 쿼리문 - 설명을 덧붙일 것  (0) 2014.10.15
계층형쿼리  (0) 2014.10.14
오라클 테스트 계정 scott lock 풀기  (0) 2014.09.29
rac설치 raw device  (0) 2014.09.19
RAC 설치시 xhost 문제  (0) 2014.09.12
Posted by 성장하는yw