설문조사
PostgreSQL/PPAS 관련 듣고 싶은 교육은


총 게시물 94건, 최근 0 건
 

오라클의 SCOTT 계정 흉내내기

글쓴이 : PostgresDBA 날짜 : 2012-12-01 (토) 15:46 조회 : 7394
demobld_postgresql.sql (3.0K), Down : 43, 2012-12-01 15:46:19
PostgreSQL 에 scott/tiger 유저를 생성한후에, 테이블들을 생성해보겠습니다.

[postgres@olmaster:~/9.2/data]$ psql -d postgres -U postgres
Password for user postgres: 
Null display is "NULL".
Timing is on.
Pager is always used.
psql (9.2.1)
Type "help" for help.

postgres@[local]:5432 postgres#SQL> CREATE ROLE scott LOGIN password 'tiger';
CREATE ROLE
Time: 12.084 ms
postgres@[local]:5432 postgres#SQL> CREATE DATABASE scottdb OWNER=scott;
CREATE DATABASE
Time: 402.028 ms
postgres@[local]:5432 postgres#SQL> \q
[postgres@olmaster:~/9.2/data]$ 

[postgres@olmaster:~/9.2/data]$ psql -U scott -d scottdb -f scott.sql  # -f 다음에 첨부화일 지정
Password for user scott: 
.........
[postgres@olmaster:~/9.2/data]$ psql -U scott -d scottdb
Password for user scott: 
Null display is "NULL".
Timing is on.
Pager is always used.
psql (9.2.1)
Type "help" for help.

scott@[local]:5432 scottdb#SQL> \d      # 생성된 테이블들을 확인할수 있습니다.
         List of relations
 Schema |   Name   | Type  | Owner 
--------+----------+-------+-------
 public | bonus    | table | scott
 public | dept     | table | scott
 public | dummy    | table | scott
 public | emp      | table | scott
 public | salgrade | table | scott
(5 rows)

scott@[local]:5432 scottdb#SQL> 

pgAdmin 으로 접속하여 확인해보겠습니다.

Image1.gif


생성된 테이블들이 public schema 에 잘 생성되어 있네요^^

PostgresDBA 2018-11-01 (목) 14:22
댓글주소
 

postgresdba.com