계정 관리
요약
user (default/Temp Ts,Profile,expired,status..) 정보 확인
select username,default_tablespace "DFTS", temporary_tablespace "TPTS", profile
from dba_users
where username='SMSUSER';
user (ROLE) 권한 조회
select * from dba_sys_privs
where grantee='TROLE'; -- trole
사용자에게 부여된 role 조회
select * from dba_role_privs
where grantee='SMSUSER';
profile 조회
select *from dba_profiles
where profile='SAMPLE_PROF';
default tablepace생성
create tablespace ts_sms
datafile '/oradata/EHR/ts_sms01.dbf' size 10M;
temporary tablespace 생성
create temporary tablespace temp_sms
tempfile '/oradata/EHR/temp_sms01.dbf' size 10M;
profile 관리 (생성 /삭제)
create profile sample_prof limit
failed_login_attempts 3
password_lock_time 5
password_life_time 15
password_reuse_time 15;
drop profile sample_prof cascade;-- 기사용 사용자는 default로 변경
role 관리
create role trole;
grant create session,create table to trole;
사용자생성
create user smsuser
identified by "smspwd"
default tablespace ts_sms
temporary tablespace temp_sms
quota unlimited on ts_sms
quota 0m on system --system tablepsace cannot use
profile sample_prof
account unlock;
grant resource,connect,trole to smsuser;
예시- 신규 User/Role/Profile 생성 및 확인
-
더보기SQL> create tablespace ts_smsdatafile '/oradata/EHR/ts_sms01.dbf' size 10M;Tablespace created.SQL> create temporary tablespace temp_smstempfile '/oradata/EHR/temp_sms01.dbf' size 10M;Tablespace created.SQL> create profile sample_prof limitfailed_login_attempts 3password_lock_time 5password_life_time 15password_reuse_time 15;Profile created.SQL> create user smsuseridentified by "smspwd"default tablespace ts_smstemporary tablespace temp_smsquota unlimited on ts_smsquota 0m on system --system tablepsace cannot useprofile sample_profaccount unlock;User created.SQL> grant resource,connect to smsuser;Grant succeeded.SQL> create role trole;Role created.SQL> grant create session,create table to trole;Grant succeeded.SQL> grant resource,connect,trole to smsuser;Grant succeeded.SQL> select tablespace_name,bytes/1024/1024 MB,file_namefrom dba_data_files;TABLESPACE MB FILE_NAME---------- ---------- --------------------------------------------------SYSTEM 430 /oraindex/EHR/system01.dbfUNDOTBS1 1024 /oradata/EHR/undotbs01.dbfSYSAUX 210 /oradata/EHR/sysaux01.dbfTS_SMS 10 /oradata/EHR/ts_sms01.dbfUSERS 5 /oradata/EHR/users01.dbfUNDO01 10 /oradata/EHR/undo01.dbf6 rows selected.SQL> select username,default_tablespace "DFTS", temporary_tablespace "TPTS", profilefrom dba_userswhere username='SMSUSER';USERNAME DFTS TPTS PROFILE------------------------------ ------------------------------ ------------------------------ -------------------SMSUSER TS_SMS TEMP_SMS SAMPLE_PROFSQL> select * from dba_role_privswhere grantee='SMSUSER';GRANTEE GRANTED_ROLE ADM DEF------------------------------ ------------------------------ --- ---SMSUSER RESOURCE NO YESSMSUSER TROLE NO YESSMSUSER CONNECT NO YESSQL> select * from dba_sys_privswhere grantee='TROLE';GRANTEE PRIVILEGE ADM------------------------------ ---------------------------------------- ---TROLE CREATE TABLE NOTROLE CREATE SESSION NOSQL> select *from dba_profileswhere profile='SAMPLE_PROF';PROFILE RESOURCE_NAME RESOURCE LIMIT------------------------------ -------------------------------- -------- ----------------------------------------SAMPLE_PROF COMPOSITE_LIMIT KERNEL DEFAULTSAMPLE_PROF SESSIONS_PER_USER KERNEL DEFAULTSAMPLE_PROF CPU_PER_SESSION KERNEL DEFAULTSAMPLE_PROF CPU_PER_CALL KERNEL DEFAULTSAMPLE_PROF LOGICAL_READS_PER_SESSION KERNEL DEFAULTSAMPLE_PROF LOGICAL_READS_PER_CALL KERNEL DEFAULTSAMPLE_PROF IDLE_TIME KERNEL DEFAULTSAMPLE_PROF CONNECT_TIME KERNEL DEFAULTSAMPLE_PROF PRIVATE_SGA KERNEL DEFAULTSAMPLE_PROF FAILED_LOGIN_ATTEMPTS PASSWORD 3SAMPLE_PROF PASSWORD_LIFE_TIME PASSWORD 15PROFILE RESOURCE_NAME RESOURCE LIMIT------------------------------ -------------------------------- -------- ----------------------------------------SAMPLE_PROF PASSWORD_REUSE_TIME PASSWORD 15SAMPLE_PROF PASSWORD_REUSE_MAX PASSWORD DEFAULTSAMPLE_PROF PASSWORD_VERIFY_FUNCTION PASSWORD DEFAULTSAMPLE_PROF PASSWORD_LOCK_TIME PASSWORD 5SAMPLE_PROF PASSWORD_GRACE_TIME PASSWORD DEFAULT16 rows selected.
Archive Log 설정
설명
- Archive redo log mode 변경 순서 (spfile)
- Shutdown -> parameter file 수정 ->Mount -> mode 변경 -> Open
요약
설정체크
archive log list;
parameter file 수정
alter system set log_archive_dest_1= 'location=/data/arc1' scope=spfile;
alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
모드변경
alter database archivelog;
예시- Archive Log 설정
더보기
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 30
Current log sequence 32
SQL> alter system set log_archive_dest_1= 'location=/data/arc1' scope=spfile;
System altered.
SQL> alter system set log_archive_dest_2= 'location=/data/arc2' scope=spfile;
System altered.
SQL> alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 385876488 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14680064 bytes
Database mounted.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /data/arc2
Oldest online log sequence 31
Current log sequence 33
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /data/arc2
Oldest online log sequence 31
Next log sequence to archive 33
Current log sequence 33
'Oracle > 기타' 카테고리의 다른 글
[관리] 테이블스페이스 (0) | 2022.03.23 |
---|---|
[관리] 파일 (data/redolog/control file) (0) | 2022.03.23 |
[기타] DB Link 구성 (0) | 2022.03.23 |
[기타]다중 인스턴스 구성 (clone 생성 및 복원) (0) | 2022.03.23 |