自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

CREATE DATABASE 中文man頁面

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

NAME

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

SYNOPSIS

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

DESCRIPTION 描述

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


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


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


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


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


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


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

PARAMETERS 參數(shù)

name

 要創(chuàng)建的數(shù)據(jù)庫名。
dbowner

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

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

 從哪個模板創(chuàng)建新數(shù)據(jù)庫,這是模板名。或者用 DEFAULT 使用缺省模板(template1)。
encoding

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


 可選參數(shù)可以以任意順序?qū)?,而不僅是上面顯示的順序。

NOTES 注意

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


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


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


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


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


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

EXAMPLES 例子


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

CREATE DATABASE lusiadas;


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

mkdir private_db
initlocation ~/private_db


 然后在一個 psql 會話里執(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é)任編輯:韓亞珊 來源: CMPP.net
相關(guān)推薦

2011-08-24 14:16:18

DROP DATABA中文man

2011-08-24 13:43:09

CREATE USER中文man

2011-08-24 13:46:39

CREATE VIEW中文man

2011-08-24 13:29:20

CREATE TABL中文man

2011-08-24 13:36:25

CREATE TRIG中文man

2011-08-24 10:56:32

CREATE CONV中文man

2011-08-24 10:46:36

CREATE AGGR中文man

2011-08-24 11:15:24

CREATE INDE中文man

2011-08-24 13:32:56

CREATE TABL中文man

2011-08-24 13:23:10

CREATE SCHE中文man

2011-08-24 11:02:11

CREATE DOMA中文man

2011-08-24 13:26:19

CREATE SEQU中文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 11:05:36

CREATE FUNC中文man

2011-08-24 13:39:44

CREATE TYPE中文man

2011-08-24 11:10:17

CREATE GROU中文man

2011-08-24 09:18:45

alter_datab中文man

2011-08-25 14:07:55

create_modu中文man
點贊
收藏

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