DBA group oracle os user 확인
[oracle@lnx04 dbs]$ cat /etc/group | grep dba
dba:x:5000:oracle
[oracle@lnx04 dbs]$ cat /etc/passwd | grep oracle
oracle:x:500:5001::/home/oracle:/bin/bash
[oracle@lnx04 dbs]$ ps -ef |grep ora_
oracle 922 1 0 17:30 ? 00:00:00 ora_arc0_orcl
oracle 945 1 0 17:30 ? 00:00:00 ora_arc1_orcl
oracle 949 1 0 17:30 ? 00:00:00 ora_arc2_orcl
oracle 953 1 0 17:30 ? 00:00:00 ora_arc3_orcl
oracle 957 1 0 17:30 ? 00:00:00 ora_qmnc_orcl
Oracle home base directory 확인
[oracle@lnx04 dbs]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@lnx04 dbs]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
리스너 기동 상태 이름 확인
[oracle@lnx04 dbs]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 13-OCT-2015 18:40:41
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/lnx04/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lnx04.ocmkorea.com)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=lnx04.ocmkorea.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 13-OCT-2015 18:40:41
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/lnx04/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lnx04.ocmkorea.com)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@lnx04 dbs]$ ps -ef |grep tns
oracle 7882 1 0 18:40 ? 00:00:00 /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr LISTENER -inherit
oracle 7898 4823 0 18:40 pts/1 00:00:00 grep tns
[oracle@lnx04 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-OCT-2015 06:34:57
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=lnx04.ocmkorea.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 15-OCT-2015 06:12:48
Uptime 0 days 0 hr. 22 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/lnx04/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lnx04.ocmkorea.com)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@lnx04 ~]$ tnsping orcl
TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 15-OCT-2015 06:44:00
Copyright (c) 1997, 2009, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (description = (address_list = (address = (protocol=tcp)(host=lnx04.ocmkorea.com)(port=1521))) (connect_data = (server=dedicated) (sid=orcl)))
OK (10 msec)
SYS@orcl>startup
ORACLE instance started.
Total System Global Area 1707446272 bytes
Fixed Size 1336988 bytes
Variable Size 1006635364 bytes
Database Buffers 687865856 bytes
Redo Buffers 11608064 bytes
Database mounted.
Database opened.
Checkpoint를 발생시키자
체크포인트를 발생시키면 CKPT는 컨트롤 파일과 Datafile Header의 내용을 갱신하여 리두 로그 파일에서 recovery가 시작되는 위치(checkpoint)를 발생시킴 또한 DBWR가 Buffer cache의 모든 수정된 내용을 해당 Database에 기록하는데 shutdown 전에 Data일관선을 유지하기 위해 실행한다
SYS@orcl>alter system checkpoint;
System altered.
Redo Log File
SYS@orcl>col member for a43
SYS@orcl>select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- ------------------------------------------- ---
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log NO
1 ONLINE /u01/app/oracle/oradata/orcl/redo01_b.log NO
3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log NO
3 ONLINE /u01/app/oracle/oradata/orcl/redo03_b.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo02_b.log NO
SYS@orcl>select group#, members, archived, status from v$log;
GROUP# MEMBERS ARC STATUS
---------- ---------- --- ----------------
1 2 YES INACTIVE
2 2 YES INACTIVE
3 2 NO CURRENT
SYS@orcl>alter database drop logfile member
2 '/u01/app/oracle/oradata/orcl/redo03_b.log';
Database altered.
SYS@orcl>select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE#
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ------------------- ------------
NEXT_TIME
-------------------
1 1 10 52428800 512 2 YES INACTIVE 1305686 2015-10-15:07:09:52 1305731
2015-10-15:07:10:15
2 1 11 52428800 512 2 NO CURRENT 1305731 2015-10-15:07:10:15 2.8147E+14
3 1 9 52428800 512 1 YES INACTIVE 1301732 2015-10-15:06:27:48 1305686
2015-10-15:07:09:52
SYS@orcl>alter database add logfile member '/u01/app/oracle/oradata/orcl/redo03_b.log'
2 to group 3;
Database altered.
SYS@orcl>select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- ------------------------------------------- ---
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log NO
1 ONLINE /u01/app/oracle/oradata/orcl/redo01_b.log NO
3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log NO
3 INVALID ONLINE /u01/app/oracle/oradata/orcl/redo03_b.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo02_b.log NO
SYS@orcl>alter database backup controlfile to '/home/oracle/control.bak';
Database altered.
SYS@orcl>!ls /home/oracle/con*
/home/oracle/control.bak
Datafile
실제 Data가 저장되는 물리적 저장공간
하나의 TBS에 여러개의 Datafile이 존재할 수 있음
SYS@orcl>select file#, name, status from v$datafile;
FILE# NAME STATUS
---------- --------------------------------------------- -------
1 /u01/app/oracle/oradata/orcl/system01.dbf SYSTEM
2 /u01/app/oracle/oradata/orcl/sysaux01.dbf ONLINE
3 /u01/app/oracle/oradata/orcl/undotbs01.dbf ONLINE
4 /u01/app/oracle/oradata/orcl/users01.dbf ONLINE
5 /u01/app/oracle/oradata/orcl/example01.dbf ONLINE
6 /u01/app/oracle/oradata/orcl/rman_tbs.dbf ONLINE
6 rows selected.
SYS@orcl>col tablespace_name for a20
SYS@orcl>col file_name for a50
SYS@orcl>select tablespace_name, file_name, bytes/1024/1024 from dba_data_files;
TABLESPACE_NAME FILE_NAME BYTES/1024/1024
-------------------- -------------------------------------------------- ---------------
RMAN_TBS /u01/app/oracle/oradata/orcl/rman_tbs.dbf 100
EXAMPLE /u01/app/oracle/oradata/orcl/example01.dbf 100
USERS /u01/app/oracle/oradata/orcl/users01.dbf 5
UNDOTBS1 /u01/app/oracle/oradata/orcl/undotbs01.dbf 105
SYSAUX /u01/app/oracle/oradata/orcl/sysaux01.dbf 540
SYSTEM /u01/app/oracle/oradata/orcl/system01.dbf 700
Oracle Log 확인
SYS@orcl>show parameter p_d;
NAME TYPE VALUE
------------------------------- ----------- ------------------------------
background_dump_dest string /u01/app/oracle/diag/rdbms/orcl/orcl/trace
core_dump_dest string /u01/app/oracle/diag/rdbms/orcl/orcl/cdump
ldap_directory_access string NONE
ldap_directory_sysauth string no
user_dump_dest string /u01/app/oracle/diag/rdbms/orcl/orcl/trace
$ORACLE_HOME/network/log
리스너를 통해 오라클에 접속한 정보와 listener start/stop log가 기록되는 파일
[oracle@lnx04 log]$ df -k /u01
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 30470144 8053436 20843948 28% /u01
SYS@orcl>alter tablespace test offline;
Tablespace altered.
SYS@orcl>select tablespace_name, status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
EXAMPLE ONLINE
RMAN_TBS ONLINE
TEST OFFLINE
8 rows selected.
SYS@orcl>select file#, name, status from v$datafile;
FILE#
----------
NAME
------------------------------------------------------------------------------------------------------------------------------------------------------
STATUS
-------
1
/u01/app/oracle/oradata/orcl/system01.dbf
SYSTEM
2
/u01/app/oracle/oradata/orcl/sysaux01.dbf
ONLINE
3
/u01/app/oracle/oradata/orcl/undotbs01.dbf
ONLINE
4
/u01/app/oracle/oradata/orcl/users01.dbf
ONLINE
5
/u01/app/oracle/oradata/orcl/example01.dbf
ONLINE
6
/u01/app/oracle/oradata/orcl/rman_tbs.dbf
ONLINE
7
/u01/app/oracle/oradata/orcl/test.dbf
OFFLINE
8
/u01/app/oracle/oradata/orcl/test2.dbf
OFFLINE
8 rows selected.
SYS@orcl>!cp /u01/app/oracle/oradata/orcl/test.dbf /home/oracle/test.dbf
SYS@orcl>alter tablespace test rename datafile '/u01/app/oracle/oradata/orcl/test.dbf' to'/home/oracle/test.dbf';
Tablespace altered.
SYS@orcl>select file#, name, status from v$datafile;
FILE#
----------
NAME
------------------------------------------------------------------------------------------------------------------------------------------------------
STATUS
-------
1
/u01/app/oracle/oradata/orcl/system01.dbf
SYSTEM
2
/u01/app/oracle/oradata/orcl/sysaux01.dbf
ONLINE
3
/u01/app/oracle/oradata/orcl/undotbs01.dbf
ONLINE
4
/u01/app/oracle/oradata/orcl/users01.dbf
ONLINE
5
/u01/app/oracle/oradata/orcl/example01.dbf
ONLINE
6
/u01/app/oracle/oradata/orcl/rman_tbs.dbf
ONLINE
7
/home/oracle/test.dbf
OFFLINE
8
/u01/app/oracle/oradata/orcl/test2.dbf
OFFLINE
8 rows selected.
SYS@orcl>alter tablespace test online;
Tablespace altered.
SYS@orcl>select tablespace_name, status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
EXAMPLE ONLINE
RMAN_TBS ONLINE
TEST ONLINE
TBS / datafile 관리
SYS@orcl>alter database datafile '/u01/app/oracle/oradata/orcl/test2.dbf' resize 300m;
Database altered.
FILE#
----------
NAME
------------------------------------------------------------------------------------------------------------------------------------------------------
STATUS BYTES/1024/1024
------- ---------------
1
8
/u01/app/oracle/oradata/orcl/test2.dbf
ONLINE 300
8 rows selected.
유저 생성 및 권한 부여
SYS@orcl>create user insa identified by oracle default tablespace TEST
2 temporary tablespace TEMP;
User created.
SYS@orcl>grant connect, resource to insa;
Grant succeeded.
SYS@orcl>drop user INSA cascade;
User dropped.
SYS@orcl>drop tablespace test including contents and datafiles;
Tablespace dropped.
'스터디북' 카테고리의 다른 글
[10/14] 실습 - 1 Flashback Transaction BACKOUT table (0) | 2015.10.14 |
---|---|
[10/14] 정리 (0) | 2015.10.14 |
[10/13] 실습 - 4 Flashback query, versions query, transaction query (0) | 2015.10.13 |
[10/13] 실습 - 3 Backupset의 병렬화 (0) | 2015.10.13 |
[10/13] 실습 - 2 RMAN을 이용한 Duplicate 복제 DB 생성 (0) | 2015.10.13 |