database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Tutorials 5878 게시물 읽기
 News | Q&A | Columns | Tutorials | Devel | Files | Links
No. 5878
initdb 없이 template1 데이터베이스 새로 만들기
작성자
김상기(ioseph)
작성일
2005-02-08 00:33
조회수
11,503
#쉘에서 관리자 권한으로 template1 DB에 접속합니다.
shell$ psql -U postgres template1

-- template0 DB의 접속을 허용하도록 바꿉니다
template1=# update pg_database set datallowconn = true where datname = 'template0';
UPDATE 1

-- template1 DB를 drop 할 수 있도록 template DB가 아니라고 설정합니다.
template1=# update pg_database set datistemplate = false where datname = 'template1';
UPDATE 1

template1=# \q

#psql 종료하고, 이번에는 template0 DB로 접속합니다.
shell$ psql -U postgres template0

-- template1 DB를 drop 합니다.
template0=# drop database template1;
DROP DATABASE

-- template0 DB로 template1 DB를 만듭니다.
template0=# create database template1 template template0;
CREATE DATABASE

-- 다시 원래대로, template0 접속을 막고
template0=# update pg_database set datallowconn = false where datname = 'template0';
UPDATE 1

-- template1 DB는 템플릿 DB임을 설정합니다.
template0=# update pg_database set datistemplate = true where datname = 'template1';
UPDATE 1

 

이 기능을 쓸 일이 있어 구현하고, 필요한 분이 있을 것 같아, 메모 남겨둡니다.

[Top]
No.
제목
작성자
작성일
조회
6024pg_config 사용법 [1]
김상기
2005-04-08
12225
5942이기종 RDBMS에서 PostgreSQL 쪽으로 바꿀 때 참고할 점
김상기
2005-02-28
14530
5918view를 이용한 column 접근 권한 제어
김상기
2005-02-22
10491
5878initdb 없이 template1 데이터베이스 새로 만들기
김상기
2005-02-08
11503
5870pg_restore 사용법 [1]
김상기
2005-02-04
24990
5854PostgreSQL 8 : Group,User관리
조성준
2005-01-30
25080
5853PostgreSQL 8 : pg_hda.conf - 보정중 [2]
조성준
2005-01-30
14900
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.047초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다