alter_database 中文man页面

系统
ALTER DATABASE 用于改变一个数据库的属性。

NAME

ALTER DATABASE - 修改一个数据库

SYNOPSIS

ALTER DATABASE name SET parameter { TO | = } { value | DEFAULT }
ALTER DATABASE name RESET parameter

ALTER DATABASE name RENAME TO newname

DESCRIPTION 描述

ALTER DATABASE 用于改变一个数据库的属性。


 头两种形式为 PostgreSQL 数据库修改缺省的会话运行时配置变量。 随后在该数据库上启动一个新的会话的时候, 在启动会话之前先有效地运行 SET variable TO value。 数据库相关的缺省值覆盖任何在 postgresql.conf 里出现或者从 postmaster 命令行接收到的设置。 只有数据库所有者或者超级用户可以为一个数据库修改会话缺省。


 第三种形式修改该数据库的名称。只有数据库所有者可以重命名一个数据库,并且只有在他有 CREATEDB 权限的时候可以。 当前的数据库不能被重命名。(如果你需要这么做,那么连接另外一个数据库。)  

PARAMETERS 参数

name

 需要修改会话缺省的数据库的名字。
parameter
value

 把指定的数据库配置变量的会话缺省值设置为给出的数值。 如果 value 使用了 DEFAULT 或者是等效的 RESET, 那么与数据库相关的变量设置将被删除并且在新的会话中将继承缺省设置。 用 RESET ALL 清除所有设置。


 参阅 SET [set(7)] 和 Section 16.4 ``Run-time Configuration'' 获取有关允许的变量名和数值的 更多信息。

newname

 数据库的新名字。

NOTES 注意


 使用 ALTER USER [alter_user(7)], 我们也可以把一个会话缺省绑定到一个特定用户,而不是某个数据库上。 如果存在冲突,那么用户声明的设置覆盖数据库相关的设置。  

EXAMPLES 例子


 要关闭在数据库 test 上缺省的索引使用∶

ALTER DATABASE test SET enable_indexscan TO off;

COMPATIBILITY 兼容性

ALTER DATABASE 语句是一个 PostgreSQL 扩展。  

SEE ALSO 参见

ALTER USER [alter_user(7)], CREATE DATABASE [create_database(l)], DROP DATABASE [drop_database(l)], SET [set(l)]

#p#

NAME

ALTER DATABASE - change a database

SYNOPSIS

ALTER DATABASE name SET parameter { TO | = } { value | DEFAULT }
ALTER DATABASE name RESET parameter

ALTER DATABASE name RENAME TO newname

DESCRIPTION

ALTER DATABASE is used to change the attributes of a database.

The first two forms change the session default of a run-time configuration variable for a PostgreSQL database. Whenever a new session is subsequently started in that database, the specified value becomes the session default value. The database-specific default overrides whatever setting is present in postgresql.conf or has been received from the postmaster command line. Only the database owner or a superuser can change the session defaults for a database.

The third form changes the name of the database. Only the database owner can rename a database, and only if he has the CREATEDB privilege. The current database cannot be renamed. (Connect to a different database if you need to do that.)  

PARAMETERS

name
The name of the database whose session defaults are to be altered.
parameter
value
Set the session default for this database of the specified configuration parameter to the given value. If value is DEFAULT or, equivalently, RESET is used, the database-specific variable setting is removed and the system-wide default setting will be inherited in new sessions. Use RESET ALL to clear all settings.

See SET [set(7)] and the section called ``Run-time Configuration'' in the documentation for more information about allowed parameter names and values.

newname
The new name of the database.

NOTES

Using ALTER USER [alter_user(7)], it is also possible to tie a session default to a specific user rather than a database. User-specific settings override database-specific ones if there is a conflict.  

EXAMPLES

To disable index scans by default in the database test:

ALTER DATABASE test SET enable_indexscan TO off;

COMPATIBILITY

The ALTER DATABASE statement is a PostgreSQL extension.  

SEE ALSO

ALTER USER [alter_user(7)], CREATE DATABASE [create_database(l)], DROP DATABASE [drop_database(l)], SET [set(l)]

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-24 09:02:10

ALTER AGGRE中文man

2011-08-24 10:59:19

CREATE DATA中文man

2011-08-24 14:16:18

DROP DATABA中文man

2011-08-24 09:48:46

alter_trigg中文man

2011-08-24 09:26:14

alter_funct中文man

2011-08-24 09:22:30

alter_domai中文man

2011-08-24 09:45:14

alter_table中文man

2011-08-24 09:29:18

alter_group中文man

2011-08-24 09:32:13

alter_langu中文man

2011-08-24 09:39:10

alter_schem中文man

2011-08-24 09:42:15

alter_seque中文man

2011-08-24 09:51:53

alter_user中文man

2011-08-24 09:14:47

alter_conve中文man

2011-08-24 09:36:00

alter_opera中文man

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-12 14:58:05

killall中文man

2011-07-15 16:58:36

ac中文man
点赞
收藏

51CTO技术栈公众号