成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

CREATE DATABASE 中文man頁(yè)面

系統(tǒng)
CREATE DATABASE 創(chuàng)建一個(gè)新的 PostgreSQL 數(shù)據(jù)庫(kù)。

NAME

CREATE DATABASE - 創(chuàng)建新數(shù)據(jù)庫(kù)

SYNOPSIS

CREATE DATABASE name
    [ [ WITH ] [ OWNER [=] dbowner ]
           [ LOCATION [=] 'dbpath' ]
           [ TEMPLATE [=] template ]
           [ ENCODING [=] encoding ] ]

DESCRIPTION 描述

CREATE DATABASE 創(chuàng)建一個(gè)新的 PostgreSQL 數(shù)據(jù)庫(kù)。


 要?jiǎng)?chuàng)建一個(gè)數(shù)據(jù)庫(kù),你必須是一個(gè)超級(jí)用戶或者有特殊的 CREATEDB 權(quán)限。 參閱 CREATE USER [create_user(7)]。


 通常,創(chuàng)建者成為新數(shù)據(jù)庫(kù)的管理員。 超級(jí)用戶可以用 OWNER 子句創(chuàng)建其它用戶所有的數(shù)據(jù)庫(kù)。 他們甚至可以創(chuàng)建沒(méi)有特殊權(quán)限的用戶所有的數(shù)據(jù)庫(kù)。 有CREATEDB權(quán)限的非超級(jí)用戶使用只能創(chuàng)建自己使用的數(shù)據(jù)庫(kù)。


 可以聲明一個(gè)可選的數(shù)據(jù)庫(kù)位置,例如,在另一塊硬盤上存放數(shù)據(jù)庫(kù)。 該路徑必須是事先用 initlocation[initlocation(1)]  命令準(zhǔn)備好了的。


 如果路徑名不包含斜杠,那么它被解釋成一個(gè)環(huán)境變量, 該變量必須為服務(wù)進(jìn)程所知。這樣數(shù)據(jù)庫(kù)管理員 可以對(duì)能夠在那里創(chuàng)建數(shù)據(jù)庫(kù)進(jìn)行控制。(例如,一個(gè)用戶化的選擇是 'PGDATA2'。)如果服務(wù)器帶著 ALLOW_ABSOLUTE_DBPATHS  (缺省時(shí)沒(méi)有)選項(xiàng)編譯, 那么也允許使用以斜杠開(kāi)頭為標(biāo)識(shí)的絕對(duì)路徑(例如, ' '/usr/local/pgsql/data')。 In either case, the final path name must be absolute and must not contain any single quotes.


 缺省時(shí),新數(shù)據(jù)庫(kù)將通過(guò)克隆標(biāo)準(zhǔn)系統(tǒng)數(shù)據(jù)庫(kù) template1  來(lái)創(chuàng)建。不同的模板可以用 TEMPLATE =  name  來(lái)寫。尤其是,如果你用 TEMPLATE = template0, 你可以創(chuàng)建一個(gè)很純凈的數(shù)據(jù)庫(kù),只包括你的版本的 PostgreSQL 預(yù)定義的 標(biāo)準(zhǔn)對(duì)象。這個(gè)方法可以避免把任何已經(jīng)加入到template1  里的本地安裝對(duì)象拷貝到新數(shù)據(jù)庫(kù)。


 可選的編碼參數(shù)允許選擇數(shù)據(jù)庫(kù)編碼, 如果沒(méi)有聲明,缺省是所選用的模板數(shù)據(jù)庫(kù)用的編碼。  

PARAMETERS 參數(shù)

name

 要?jiǎng)?chuàng)建的數(shù)據(jù)庫(kù)名。
dbowner

 數(shù)據(jù)庫(kù)用戶的名字,他將擁有新數(shù)據(jù)庫(kù),或者是寫 DEFAULT  使用缺省的(也就是執(zhí)行命令的用戶)。
dbpath

     在文件系統(tǒng)里存儲(chǔ)新數(shù)據(jù)庫(kù)的可選位置;用字串文本聲明。 或者用 DEFAULT 表示使用缺省位置。 
template

 從哪個(gè)模板創(chuàng)建新數(shù)據(jù)庫(kù),這是模板名?;蛘哂?nbsp;DEFAULT 使用缺省模板(template1)。
encoding

 創(chuàng)建新數(shù)據(jù)庫(kù)用的多字節(jié)編碼方法。聲明一個(gè)字串文本名字 (比如,'SQL_ASCII'), 或者一個(gè)整數(shù)編號(hào),或者是 DEFAULT  表示使用缺省編碼。


 可選參數(shù)可以以任意順序?qū)懀粌H是上面顯示的順序。

NOTES 注意

CREATE DATABASE 不能在一個(gè)事務(wù)塊里面執(zhí)行。 block.


 類似 "could not initialize database directory" 這樣的錯(cuò)誤最有可能是因?yàn)閿?shù)據(jù)目錄的權(quán)限不夠, 或者磁盤滿,或者其它文件系統(tǒng)的問(wèn)題。在使用可選的位置的時(shí)候,運(yùn)行數(shù)據(jù)庫(kù)服務(wù)器的用戶必須有訪問(wèn)該位置的權(quán)限。


 使用 DROP DATABASE [drop_database(7)]  刪除一個(gè)數(shù)據(jù)庫(kù)。


 程序 createdb[createdb(1)] 是是這個(gè)命令的封裝,提供來(lái)方便使用。


 在用絕對(duì)路徑指定的可選數(shù)據(jù)庫(kù)位置時(shí),有一些安全和數(shù)據(jù)完整性的問(wèn)題, 這就是為什么缺省時(shí)沒(méi)有打開(kāi)這個(gè)特性的原因。 參考 ``Managing Databases'' 獲取更多的信息。


 盡管我們可以通過(guò)把某數(shù)據(jù)庫(kù)名聲明為模板(而非 template1)從非template1數(shù)據(jù)庫(kù)拷貝數(shù)據(jù)庫(kù), 但是這(還)不是一個(gè)通用的 "COPY DATABASE" 功能。 因此,我們建議當(dāng)做模板使用的數(shù)據(jù)庫(kù)都應(yīng)該是以只讀方式對(duì)待的。 參閱 ``Managing Databases'' 獲取更多信息。  

EXAMPLES 例子


 創(chuàng)建一個(gè)新的數(shù)據(jù)庫(kù):

CREATE DATABASE lusiadas;


 在另一個(gè)地方 ~/private_db創(chuàng)建新數(shù)據(jù)庫(kù), 在 shell 里執(zhí)行下面的東西: shell:

mkdir private_db
initlocation ~/private_db


 然后在一個(gè) psql 會(huì)話里執(zhí)行下面的東西:

CREATE DATABASE elsewhere WITH LOCATION '/home/olly/private_db';

#p#

NAME

CREATE DATABASE - create a new database

SYNOPSIS

CREATE DATABASE name
    [ [ WITH ] [ OWNER [=] dbowner ]
           [ LOCATION [=] 'dbpath' ]
           [ TEMPLATE [=] template ]
           [ ENCODING [=] encoding ] ]

DESCRIPTION

CREATE DATABASE creates a new PostgreSQL database.

To create a database, you must be a superuser or have the special CREATEDB privilege. See CREATE USER [create_user(7)].

Normally, the creator becomes the owner of the new database. Superusers can create databases owned by other users using the OWNER clause. They can even create databases owned by users with no special privileges. Non-superusers with CREATEDB privilege can only create databases owned by themselves.

An alternative location can be specified in order to, for example, store the database on a different disk. The path must have been prepared with the initlocation [initlocation(1)] command.

If the path name does not contain a slash, it is interpreted as an environment variable name, which must be known to the server process. This way the database administrator can exercise control over locations in which databases can be created. (A customary choice is, e.g., PGDATA2.) If the server is compiled with ALLOW_ABSOLUTE_DBPATHS (not so by default), absolute path names, as identified by a leading slash (e.g., /usr/local/pgsql/data), are allowed as well. In either case, the final path name must be absolute and must not contain any single quotes.

By default, the new database will be created by cloning the standard system database template1. A different template can be specified by writing TEMPLATE name. In particular, by writing TEMPLATE template0, you can create a virgin database containing only the standard objects predefined by your version of PostgreSQL. This is useful if you wish to avoid copying any installation-local objects that may have been added to template1.

The optional encoding parameter allows selection of the database encoding. When not specified, it defaults to the encoding used by the selected template database.  

PARAMETERS

name
The name of a database to create.
dbowner
The name of the database user who will own the new database, or DEFAULT to use the default (namely, the user executing the command).
dbpath
An alternate file-system location in which to store the new database, specified as a string literal; or DEFAULT to use the default location.
template
The name of the template from which to create the new database, or DEFAULT to use the default template (template1).
encoding
Character set encoding to use in the new database. Specify a string constant (e.g., 'SQL_ASCII'), or an integer encoding number, or DEFAULT to use the default encoding.

Optional parameters can be written in any order, not only the order illustrated above.

NOTES

CREATE DATABASE cannot be executed inside a transaction block.

Errors along the line of ``could not initialize database directory'' are most likely related to insufficient permissions on the data directory, a full disk, or other file system problems. When using an alternate location, the user under which the database server is running must have access to the location.

Use DROP DATABASE [drop_database(7)] to remove a database.

The program createdb [createdb(1)] is a wrapper program around this command, provided for convenience.

There are security issues involved with using alternate database locations specified with absolute path names; this is why the feature is not enabled by default. See the chapter called ``Managing Databases'' in the documentation for more information.

Although it is possible to copy a database other than template1 by specifying its name as the template, this is not (yet) intended as a general-purpose ``COPY DATABASE'' facility. We recommend that databases used as templates be treated as read-only. See the chapter called ``Managing Databases'' in the documentation for more information.  

EXAMPLES

To create a new database:

CREATE DATABASE lusiadas;

To create a new database in an alternate area ~/private_db, execute the following from the shell:

mkdir private_db
initlocation ~/private_db

Then execute the following from within a psql session:

CREATE DATABASE elsewhere WITH LOCATION '/home/olly/private_db';

責(zé)任編輯:韓亞珊 來(lái)源: CMPP.net
相關(guān)推薦

2011-08-24 14:16:18

DROP DATABA中文man

2011-08-24 10:46:36

CREATE AGGR中文man

2011-08-24 10:56:32

CREATE CONV中文man

2011-08-24 11:15:24

CREATE INDE中文man

2011-08-24 13:29:20

CREATE TABL中文man

2011-08-24 13:36:25

CREATE TRIG中文man

2011-08-24 13:43:09

CREATE USER中文man

2011-08-24 13:46:39

CREATE VIEW中文man

2011-08-24 13:32:56

CREATE TABL中文man

2011-08-24 11:02:11

CREATE DOMA中文man

2011-08-24 11:05:36

CREATE FUNC中文man

2011-08-24 11:10:17

CREATE GROU中文man

2011-08-24 11:18:53

CREATE LANG中文man

2011-08-24 11:23:20

CREATE OPER中文man

2011-08-24 11:31:47

CREATE RULE中文man

2011-08-24 13:23:10

CREATE SCHE中文man

2011-08-24 13:26:19

CREATE SEQU中文man

2011-08-24 13:39:44

CREATE TYPE中文man

2011-08-24 09:18:45

alter_datab中文man

2011-08-24 10:53:20

CREATE CONS中文man
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)

主站蜘蛛池模板: 伊人春色在线观看 | 国产精品99精品久久免费 | 一级片在线视频 | 欧美一级二级三级视频 | 99re6在线视频 | 一区在线视频 | 欧美色综合一区二区三区 | www成年人视频 | 日本在线视 | 久久婷婷麻豆国产91天堂 | 91日韩 | h视频在线免费 | av看看 | 日韩中文字幕av | 久久久日韩精品一区二区三区 | 亚洲在线免费观看 | 欧美一区二区三区在线观看视频 | 91精品国产综合久久婷婷香蕉 | 性高湖久久久久久久久3小时 | 特级黄一级播放 | 免费国产一区 | 欧美一级毛片久久99精品蜜桃 | 91久久精品国产91久久性色tv | 午夜爽爽爽男女免费观看 | 97国产爽爽爽久久久 | 久久精品国产99国产精品 | 久久精品无码一区二区三区 | 中文字幕日韩欧美 | 精品国产精品国产偷麻豆 | 91视频进入| 免费国产一区二区 | 久久久久久综合 | 亚洲97| 国产在线视频99 | 狠狠躁躁夜夜躁波多野结依 | 久久久久久高潮国产精品视 | 国产精品永久免费观看 | 黄色片a级 | 国产一级一级毛片 | 日本网站免费观看 | 亚洲免费在线观看视频 |