본문 바로가기
프로그래밍/SQL, Hive, SAS 관련 정보

[SQL 기초] SID/Service Name 확인하기

by TrillionNT 2024. 10. 24.

2025.02.24 - [프로그래밍/SQL, Hive, SAS 관련 정보] - [SQL] Table of Contents


 

select * from all_objects where object_name like '명';

명령프롬프트 조회

보통 일반적인 테스트 환경이나 소규모 사이트의 경우 데이타베이스가 하나만으로 구성되어 있고 이 때는 SID service name이 구분되지 않음(데이터베이스 이름(service name)=SID)
RAC
로 구성하여 데이타베이스 두개가 동시 가동되는 경우라면 이 SID 가 서로 다를 수 있다.


1. 명령프롬프트: (IP:Port/Service 명 확인 가능)

lsnrctl status

2. 명령프롬프트 dba 접속:

/ as sysdba

3. 명령프롬프트 service name 확인:

SELECT NAME, DB_UNIQUE_NAME FROM v$database;

4) 명령프롬프트 SID 확인:

SELECT instance FROM v$thread;

 

오브젝트 목록 조회

1. 현재 schema 명 정보 조회

SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') AS "CURRENT_SCHEMA"
FROM DUAL;

2. Oracle User 확인

select * from all_users;

3. 등록된 User 목록 보기

select username, user_id from dba_users order by username;

4. User가 소유한 모든 table보기

select table_name from user_tables;

5. 사용자 정보 확인

select username, default_tablespace,temporary_tablespace from dba_users;

6. object 조회

select * from all_objects where object_name like '명';

7. table 조회

select * from all_tables where table_name like '명';

8. 시퀀스 정보 조회

select * from user_sequences;

9. Synonym 조회

select * from all_synonyms where synonym_name='명';

10. table index정보 조회

select * from all_ind_columns where table_name='테이블명';

11. table column정보 조회

select * from all_tab_columns where table_name='테이블명';

 

사용자 생성/권한부여

1. 사용자 생성

CREATE USER C##FINANCE IDENTIFIED BY "1234"

2. 권한부여

GRANT CONNECT, RESOURCE, DBA TO C##FINANCE;