标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-00742 ORA-01110 ORA-01555 ORA-01578 ORA-01595 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (103)
- 数据库 (1,767)
- DB2 (22)
- MySQL (77)
- Oracle (1,608)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (166)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (69)
- Oracle Bug (8)
- Oracle RAC (54)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (590)
- Oracle安装升级 (97)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (86)
- PostgreSQL (30)
- pdu工具 (6)
- PostgreSQL恢复 (9)
- SQL Server (32)
- SQL Server恢复 (13)
- TimesTen (7)
- 达梦数据库 (3)
- 达梦恢复 (1)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (39)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (22)
-
最近发表
- ORA-00756 ORA-10567故障数据0丢失恢复
- 数据库文件变成32k故障恢复
- tcp连接过多导致监听TNS-12532 TNS-12560 TNS-00502错误
- 文件系统格式化MySQL数据库恢复
- .sstop勒索加密数据库恢复
- 解决一次硬件恢复之后数据文件0kb的故障恢复case
- Error in invoking target ‘libasmclntsh19.ohso libasmperl19.ohso client_sharedlib’问题处理
- ORA-01171: datafile N going offline due to error advancing checkpoint
- linux环境oracle数据库被文件系统勒索加密为.babyk扩展名溯源
- ORA-600 ksvworkmsgalloc: bad reaper
- ORA-600 krccfl_chunk故障处理
- Oracle Recovery Tools恢复案例总结—202505
- ORA-600 kddummy_blkchk 数据库循环重启
- 记录一次asm disk加入到vg通过恢复直接open库的案例
- CHECKDB 发现了 N 个分配错误和 M 个一致性错误
- 达梦数据库dm.ctl文件异常恢复
- Oracle Recovery Tools修复ORA-00742、ORA-600 ktbair2: illegal inheritance故障
- 可能是 tempdb 空间用尽或某个系统表不一致故障处理
- 11.2.0.4库中遇到ORA-600 kcratr_nab_less_than_odr报错
- [MY-013183] [InnoDB] Assertion failure故障处理
月归档:六月 2015
ORA-00600[kjhn_post_ha_alert0-862]原因分析
数据库版本和平台信息
数据库版本为10.2.0.1版本,而且是32位的win 2003 sp2之上
ORACLE V10.2.0.1.0 - Production vsnsta=0 vsnsql=14 vsnxtr=3 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options Windows Server 2003 Version V5.2 Service Pack 2 CPU : 2 - type 586, 1 Physical Cores Process Affinity : 0x00000000 Memory (Avail/Total): Ph:2608M/3990M, Ph+PgF:4511M/5871M, VA:1242M/2047M Instance name: orcl
数据库报大量ORA-600[kjhn_post_ha_alert0-862]错误
数据库的mmon进程报大量ORA-00600: internal error code, arguments: [kjhn_post_ha_alert0-862], [], [], [], [], [], [], []错误
Wed Jun 03 21:50:40 2015 Restarting dead background process MMON MMON started with pid=11, OS id=3804 Wed Jun 03 21:50:43 2015 Errors in file e:\oracle\product\10.2.0\admin\orcl\bdump\orcl_mmon_3804.trc: ORA-00600: internal error code, arguments: [kjhn_post_ha_alert0-862], [], [], [], [], [], [], [] Wed Jun 03 21:50:49 2015 Errors in file e:\oracle\product\10.2.0\admin\orcl\bdump\orcl_mmon_3804.trc: ORA-00600: internal error code, arguments: [kjhn_post_ha_alert0-862], [], [], [], [], [], [], [] Wed Jun 03 21:55:44 2015 Errors in file e:\oracle\product\10.2.0\admin\orcl\bdump\orcl_mmon_3804.trc: ORA-00600: internal error code, arguments: [kjhn_post_ha_alert0-862], [], [], [], [], [], [], [] Wed Jun 03 21:55:49 2015 Errors in file e:\oracle\product\10.2.0\admin\orcl\bdump\orcl_mmon_3804.trc: ORA-00600: internal error code, arguments: [kjhn_post_ha_alert0-862], [], [], [], [], [], [], [] Wed Jun 03 22:00:40 2015 Thread 1 advanced to log sequence 476 Current log# 1 seq# 476 mem# 0: E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG Wed Jun 03 22:00:44 2015 Errors in file e:\oracle\product\10.2.0\admin\orcl\bdump\orcl_mmon_3804.trc: ORA-00600: internal error code, arguments: [kjhn_post_ha_alert0-862], [], [], [], [], [], [], []
查询对应trace文件发现
ORA-00600: internal error code, arguments: [kjhn_post_ha_alert0-862], [], [], [] , [], [], [], [] Current SQL statement for this session: BEGIN :success := dbms_ha_alerts_prvt.check_ha_resources; END;
人工执行该过程
SQL> var success varchar2 SQL> begin 2 :success := sys.dbms_ha_alerts_prvt.check_ha_resources; 3 end; 4 / PL/SQL procedure successfully completed. SQL> print success SUCCESS -------------------------------- N
通过查询相关资料得到如下说明
@ This check is triggered with FAN enabled at this instance and it seems to be @ associated with a startup action. From the procedure itself which is called @ this is a run-once MMON (startup) action which supports instance down @ notification reliability. It does the folowing a) registers the current @ instance incarnation in recent_resource_incarnations$ if it's not already @ there b) deletes recent_resource_incarnations$ records that don't apply to @ this database. They may, e.g., have been copied from seed db or from a former @ DataGuard primary c) scans recent_resource_incarnations$ for instance @ incarnations that are no longer alive, and submits instance down alerts for @ them . If all is good then return 'Y' else 'N' (or error) if there is a @ failure. That failure is to get back to MMON, so that it may retry this @ action later. In the local instance I get a 'Y' but in the customer's system @ it fails with a 'N' which seems related to the ORA-600 assert. @ This function is kjhn_post_ha_alert0() which is internal and does the real work of @ posting HA alerts. It is used by both kjhn_post_ha_alert and @ kjn_post_ha_alert_plsql. Its parameters are basically the same as those of @ kjhn_post_ha_alert,other than the fact that it uses individual parameters @ rather than the more easily extensible structure. Also the parameters passed @ to it are the instance_name and the host_name which is the kernelized @ implementation for posting HA alerts. Without actually having the arguments @ the guess is that either the host_name or the instance_name raised in the @ assert is null which triggered it.
mmon进程尝试调用相关程序,然后无法得出正确值,返回N,然后会一直尝试,如果不能得到返回Y,就会一直报ORA-600,错误.通过上述的三种情况来说,都和recent_resource_incarnations$表有关系.
该故障原因是由于:mmon在调用kjhn_post_ha_alert0函数在执行的时候,如果发现参数host_name或者instance_name为null,就会报该错误出来.
处理方法
This problem has been documented as Bug 5173066 REPEATED ORA-600 [KJHN_POST_HA_ALERT0-862] FROM MMON PROCESS.
The bug is fixed in 11.1.0.6. A workaround is available for the problem.
该bug在11.1.0.6中得以修复
To implement the workaround, please execute the following steps as the SYS user: 1. Collect the following information and spool it to a file for your records. a. output of select * from v$instance b. show parameter instance_name c. set pages 1000 d. select * from recent_resource_incarnations$ 2. Create a backup table of recent_resource_incarnations$. SQL> create table recent_resource_inc$bk as select * from recent_resource_incarnations$; 3. Truncate recent_resource_incarnations$. Be sure to do this while the instance is up and running. Do not issue this statement if a shutdown is pending. SQL> truncate table recent_resource_incarnations$; 4. Perform a clean shutdown, followed by a startup.
具体参考:
ORA-600 [kjhn_post_ha_alert0-862] Continuously Repeated in the Alert Log (Doc ID 401640.1)
Bug 5173066 : REPEATED ORA-600 [KJHN_POST_HA_ALERT0-862] FROM MMON PROCESS
PostgreSQL简单操作之—创建库,登录,ddl,dml,help,登出,删除库
PostgreSQL创建数据库
使用shell级别的createdb命令创建xifenfei库
-bash-3.2$ createdb xifenfei
系统认证登录PostgreSQL数据库
使用psql登录PostgreSQL中的xifenfei数据库
-bash-3.2$ psql xifenfei psql (9.4.4) Type "help" for help.
PostgreSQL简单查询测试
通过查询版本,当前日期,简单加法等sql语句,测试PostgreSQL中的sql操作
xifenfei=# xifenfei=# SELECT version(); version --------------------------------------------------------------------------------------------------------------- PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55), 64-bit (1 row) xifenfei=# SELECT current_date; date ------------ 2015-06-21 (1 row) xifenfei=# SELECT 2 + 2; ?column? ---------- 4 (1 row)
PostgreSQL数据库简单ddl和dml测试
通过创建表,插入/更新/删除记录,删除表等操作
xifenfei=# create table t_xifenfei(id int,name varchar(100)); CREATE TABLE xifenfei=# insert into t_xifenfei values(1,'www.xifenfei.com'); INSERT 0 1 xifenfei=# select * from t_xifenfei; id | name ----+------------------ 1 | www.xifenfei.com (1 row) xifenfei=# insert into t_xifenfei values(2,'www.orasos.com'); INSERT 0 1 xifenfei=# select * from t_xifenfei; id | name ----+------------------ 1 | www.xifenfei.com 2 | www.orasos.com (2 rows) xifenfei=# update t_xifenfei set name='WWW.XIFENFEI.COM' WHERE ID=2; UPDATE 1 xifenfei=# select * from t_xifenfei; id | name ----+------------------ 1 | www.xifenfei.com 2 | WWW.XIFENFEI.COM (2 rows) xifenfei=# delete from t_xifenfei where id=2; DELETE 1 xifenfei=# select * from t_xifenfei; id | name ----+------------------ 1 | www.xifenfei.com (1 row) xifenfei=# drop table t_xifenfei; DROP TABLE xifenfei=# select * from t_xifenfei; ERROR: relation "t_xifenfei" does not exist LINE 1: select * from t_xifenfei; ^
PostgreSQL数据库帮助使用方法
PostgreSQL数据库使用\h命令来查看帮助
xifenfei=# \h Available help: ABORT CLUSTER DECLARE EXPLAIN ALTER AGGREGATE COMMENT DELETE FETCH ALTER COLLATION COMMIT DISCARD GRANT ALTER CONVERSION COMMIT PREPARED DO INSERT ALTER DATABASE COPY DROP AGGREGATE LISTEN ALTER DEFAULT PRIVILEGES CREATE AGGREGATE DROP CAST LOAD ALTER DOMAIN CREATE CAST DROP COLLATION LOCK ALTER EVENT TRIGGER CREATE COLLATION DROP CONVERSION MOVE ALTER EXTENSION CREATE CONVERSION DROP DATABASE NOTIFY ALTER FOREIGN DATA WRAPPER CREATE DATABASE DROP DOMAIN PREPARE ALTER FOREIGN TABLE CREATE DOMAIN DROP EVENT TRIGGER PREPARE TRANSACTION ALTER FUNCTION CREATE EVENT TRIGGER DROP EXTENSION REASSIGN OWNED ALTER GROUP CREATE EXTENSION DROP FOREIGN DATA WRAPPER REFRESH MATERIALIZED VIEW ALTER INDEX CREATE FOREIGN DATA WRAPPER DROP FOREIGN TABLE REINDEX ALTER LANGUAGE CREATE FOREIGN TABLE DROP FUNCTION RELEASE SAVEPOINT ALTER LARGE OBJECT CREATE FUNCTION DROP GROUP RESET ALTER MATERIALIZED VIEW CREATE GROUP DROP INDEX REVOKE ALTER OPERATOR CREATE INDEX DROP LANGUAGE ROLLBACK ALTER OPERATOR CLASS CREATE LANGUAGE DROP MATERIALIZED VIEW ROLLBACK PREPARED ALTER OPERATOR FAMILY CREATE MATERIALIZED VIEW DROP OPERATOR ROLLBACK TO SAVEPOINT ALTER ROLE CREATE OPERATOR DROP OPERATOR CLASS SAVEPOINT ALTER RULE CREATE OPERATOR CLASS DROP OPERATOR FAMILY SECURITY LABEL ALTER SCHEMA CREATE OPERATOR FAMILY DROP OWNED SELECT ALTER SEQUENCE CREATE ROLE DROP ROLE SELECT INTO ALTER SERVER CREATE RULE DROP RULE SET ALTER SYSTEM CREATE SCHEMA DROP SCHEMA SET CONSTRAINTS ALTER TABLE CREATE SEQUENCE DROP SEQUENCE SET ROLE ALTER TABLESPACE CREATE SERVER DROP SERVER SET SESSION AUTHORIZATION ALTER TEXT SEARCH CONFIGURATION CREATE TABLE DROP TABLE SET TRANSACTION ALTER TEXT SEARCH DICTIONARY CREATE TABLE AS DROP TABLESPACE SHOW ALTER TEXT SEARCH PARSER CREATE TABLESPACE DROP TEXT SEARCH CONFIGURATION START TRANSACTION ALTER TEXT SEARCH TEMPLATE CREATE TEXT SEARCH CONFIGURATION DROP TEXT SEARCH DICTIONARY TABLE ALTER TRIGGER CREATE TEXT SEARCH DICTIONARY DROP TEXT SEARCH PARSER TRUNCATE ALTER TYPE CREATE TEXT SEARCH PARSER DROP TEXT SEARCH TEMPLATE UNLISTEN ALTER USER CREATE TEXT SEARCH TEMPLATE DROP TRIGGER UPDATE ALTER USER MAPPING CREATE TRIGGER DROP TYPE VACUUM ALTER VIEW CREATE TYPE DROP USER VALUES ANALYZE CREATE USER DROP USER MAPPING WITH BEGIN CREATE USER MAPPING DROP VIEW CHECKPOINT CREATE VIEW END CLOSE DEALLOCATE EXECUTE xifenfei-# \h CREATE TABLE AS Command: CREATE TABLE AS Description: define a new table from the results of a query Syntax: CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE table_name [ (column_name [, ...] ) ] [ WITH ( storage_parameter [= value] [, ... ] ) | WITH OIDS | WITHOUT OIDS ] [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ] [ TABLESPACE tablespace_name ] AS query [ WITH [ NO ] DATA ]
PostgreSQL退出登录
xifenfei-# \q -bash-3.2$
PostgreSQL删除数据库
-bash-3.2$ dropdb xifenfei -bash-3.2$ psql xifenfei psql: FATAL: database "xifenfei" does not exist
在linux上安装PostgreSQL 9.4并启动和关闭数据库
PostgreSQL是以加州大学伯克利分校计算机系开发的 POSTGRES, Version 4.2为基础的对象关系型数据库管理系统(ORDBMS)。POSTGRES开创的许多概念在很久以后才出现在商业数据库中。PostgreSQL是最初伯克利代码的一个开放源码的继承者。它支持大部分SQL标准并且提供了许多其它现代特性:
复杂查询
外键
触发器
可更新的视图
事务完整性
多版本并发控制
另外,PostgreSQL可以用许多方法进行扩展,比如通过增加新的:
数据类型
函数
操作符
聚合函数
索引方法
过程语言
在个人看来,在开源数据库中PostgreSQL 是和ORACLE最相近的一个,和ORACLE兼容性较好,如果去IOE,该数据库是一个不错的选择
操作系统版本
[root@web103 ~]# more /etc/issue CentOS release 5.9 (Final) Kernel \r on an \m [root@web103 ~]# uname -a Linux web103 2.6.18-348.el5 #1 SMP Tue Jan 8 17:53:53 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
下载对应PostgreSQL对应rpm包
因为操作系统版本为CentOS 5.9的64位Linux,因此下载对应版本prm包,主要下载了server,client,contrib,libs四个包
[root@web103 ~]# mkdir pg [root@web103 ~]# cd pg [root@web103 pg]# wget http://yum.postgresql.org/9.4/redhat/rhel-5-x86_64/postgresql94-9.4.4-1PGDG.rhel5.x86_64.rpm --2015-06-16 20:44:52-- http://yum.postgresql.org/9.4/redhat/rhel-5-x86_64/postgresql94-9.4.4-1PGDG.rhel5.x86_64.rpm Resolving yum.postgresql.org... 174.143.35.196, 2001:4800:1501:1::196 Connecting to yum.postgresql.org|174.143.35.196|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1807607 (1.7M) [application/x-redhat-package-manager] Saving to: `postgresql94-9.4.4-1PGDG.rhel5.x86_64.rpm' 100%[===================================================================================================================>] 1,807,607 73.6K/s in 30s 2015-06-16 20:45:24 (58.1 KB/s) - `postgresql94-9.4.4-1PGDG.rhel5.x86_64.rpm' saved [1807607/1807607] [root@web103 pg]# wget http://yum.postgresql.org/9.4/redhat/rhel-5-x86_64/postgresql94-server-9.4.4-1PGDG.rhel5.x86_64.rpm --2015-06-16 20:45:35-- http://yum.postgresql.org/9.4/redhat/rhel-5-x86_64/postgresql94-server-9.4.4-1PGDG.rhel5.x86_64.rpm Resolving yum.postgresql.org... 174.143.35.196, 2001:4800:1501:1::196 Connecting to yum.postgresql.org|174.143.35.196|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 6175991 (5.9M) [application/x-redhat-package-manager] Saving to: `postgresql94-server-9.4.4-1PGDG.rhel5.x86_64.rpm' 100%[===================================================================================================================>] 6,175,991 58.5K/s in 2m 4s 2015-06-16 20:47:42 (48.6 KB/s) - `postgresql94-server-9.4.4-1PGDG.rhel5.x86_64.rpm' saved [6175991/6175991] [root@web103 pg]# wget http://yum.postgresql.org/9.4/redhat/rhel-5-x86_64/postgresql94-contrib-9.4.4-1PGDG.rhel5.x86_64.rpm --2015-06-16 20:47:51-- http://yum.postgresql.org/9.4/redhat/rhel-5-x86_64/postgresql94-contrib-9.4.4-1PGDG.rhel5.x86_64.rpm Resolving yum.postgresql.org... 174.143.35.196, 2001:4800:1501:1::196 Connecting to yum.postgresql.org|174.143.35.196|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 664051 (648K) [application/x-redhat-package-manager] Saving to: `postgresql94-contrib-9.4.4-1PGDG.rhel5.x86_64.rpm' 100%[===================================================================================================================>] 664,051 28.1K/s in 53s 2015-06-16 20:48:46 (12.3 KB/s) - `postgresql94-contrib-9.4.4-1PGDG.rhel5.x86_64.rpm' saved [664051/664051] [root@web103 pg]# wget http://yum.postgresql.org/9.4/redhat/rhel-5-x86_64/postgresql94-libs-9.4.4-1PGDG.rhel5.x86_64.rpm --2015-06-16 20:51:10-- http://yum.postgresql.org/9.4/redhat/rhel-5-x86_64/postgresql94-libs-9.4.4-1PGDG.rhel5.x86_64.rpm Resolving yum.postgresql.org... 174.143.35.196, 2001:4800:1501:1::196 Connecting to yum.postgresql.org|174.143.35.196|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 233206 (228K) [application/x-redhat-package-manager] Saving to: `postgresql94-libs-9.4.4-1PGDG.rhel5.x86_64.rpm' 100%[===================================================================================================================>] 233,206 70.3K/s in 3.2s 2015-06-16 20:51:16 (70.3 KB/s) - `postgresql94-libs-9.4.4-1PGDG.rhel5.x86_64.rpm' saved [233206/233206] [root@web103 pg]# ls postgresql94-9.4.4-1PGDG.rhel5.x86_64.rpm postgresql94-libs-9.4.4-1PGDG.rhel5.x86_64.rpm postgresql94-contrib-9.4.4-1PGDG.rhel5.x86_64.rpm postgresql94-server-9.4.4-1PGDG.rhel5.x86_64.rpm
安装PostgreSQL rpm包
[root@web103 pg]# rpm -ivh *.rpm warning: postgresql94-9.4.4-1PGDG.rhel5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 442df0f8 Preparing... ########################################### [100%] 1:postgresql94-libs ########################################### [ 25%] 2:postgresql94 ########################################### [ 50%] 3:postgresql94-contrib ########################################### [ 75%] 4:postgresql94-server ########################################### [100%]
创建PostgreSQL 默认库
[root@web103 pg]# service postgresql-9.4 initdb Initializing database: [ OK ] [root@web103 data]# pwd /var/lib/pgsql/9.4/data [root@web103 data]# ls -ltr total 120 -rw------- 1 postgres postgres 21265 Jun 16 20:52 postgresql.conf -rw------- 1 postgres postgres 88 Jun 16 20:52 postgresql.auto.conf drwx------ 3 postgres postgres 4096 Jun 16 20:52 pg_xlog -rw------- 1 postgres postgres 4 Jun 16 20:52 PG_VERSION drwx------ 2 postgres postgres 4096 Jun 16 20:52 pg_twophase drwx------ 2 postgres postgres 4096 Jun 16 20:52 pg_tblspc drwx------ 2 postgres postgres 4096 Jun 16 20:52 pg_subtrans drwx------ 2 postgres postgres 4096 Jun 16 20:52 pg_snapshots drwx------ 2 postgres postgres 4096 Jun 16 20:52 pg_serial drwx------ 2 postgres postgres 4096 Jun 16 20:52 pg_replslot drwx------ 4 postgres postgres 4096 Jun 16 20:52 pg_multixact drwx------ 4 postgres postgres 4096 Jun 16 20:52 pg_logical -rw------- 1 postgres postgres 1636 Jun 16 20:52 pg_ident.conf -rw------- 1 postgres postgres 4224 Jun 16 20:52 pg_hba.conf drwx------ 2 postgres postgres 4096 Jun 16 20:52 pg_dynshmem drwx------ 2 postgres postgres 4096 Jun 16 20:52 pg_clog drwx------ 5 postgres postgres 4096 Jun 16 20:52 base drwx------ 2 postgres postgres 4096 Jun 16 21:16 pg_log drwx------ 2 postgres postgres 4096 Jun 16 21:16 global -rw------- 1 postgres postgres 80 Jun 16 21:39 postmaster.pid -rw------- 1 postgres postgres 59 Jun 16 21:39 postmaster.opts drwx------ 2 postgres postgres 4096 Jun 16 21:39 pg_stat drwx------ 2 postgres postgres 4096 Jun 16 21:39 pg_notify drwx------ 2 postgres postgres 4096 Jun 16 22:00 pg_stat_tmp
另外还可以通过如下两种方式创建
initdb -D /var/lib/pgsql/9.4/data pg_ctl -D /var/lib/pgsql/9.4/data
设置PostgreSQL 开机自动启动
[root@web103 pg]# chkconfig postgresql-9.4 on [root@web103 pg]# chkconfig --list|grep post postgresql-9.4 0:off 1:off 2:on 3:on 4:on 5:on 6:off
查看默认创建PostgreSQL 用户
[root@web103 data]# more /etc/passwd|grep post postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
增加PATH环境变量
-bash-3.2$echo "PATH=$PATH:/usr/pgsql-9.4/bin;export PATH" >>~/.bash_profile
启动PostgreSQL 数据库
--方法1 -bash-3.2$ postgres -D /var/lib/pgsql/9.4/data ----或者 -bash-3.2$ postgres -D /var/lib/pgsql/9.4/data >~/pg.log 2>&1 & 方法2 pg_ctl start -l ~/pg.log -D /var/lib/pgsql/9.4/data
这里如果在环境变量中配置了PGDATA,那-D也可以不指定,-l为指定日志目录,建议使用封装的方法2启动pg
查看PostgreSQL进程信息
[root@web103 data]# ps -ef|grep post|grep -v grep postgres 4432 1 0 21:39 ? 00:00:00 /usr/pgsql-9.4/bin/postgres -D /var/lib/pgsql/9.4/data postgres 4433 4432 0 21:39 ? 00:00:00 postgres: logger process postgres 4435 4432 0 21:39 ? 00:00:00 postgres: checkpointer process postgres 4436 4432 0 21:39 ? 00:00:00 postgres: writer process postgres 4437 4432 0 21:39 ? 00:00:00 postgres: wal writer process postgres 4438 4432 0 21:39 ? 00:00:00 postgres: autovacuum launcher process postgres 4439 4432 0 21:39 ? 00:00:00 postgres: stats collector process
这里可以看到pg也和oracle有几分类似,有日志进程,checkpoint进程,有写进程等(具体以后分析)
停止PostgreSQL数据库
-bash-3.2$ pg_ctl stop -D /var/lib/pgsql/9.4/data waiting for server to shut down.... done server stopped -bash-3.2$ ps -ef|grep post|grep -v grep root 6036 499 0 22:07 pts/0 00:00:00 su - postgres postgres 6037 6036 0 22:07 pts/0 00:00:00 -bash postgres 6113 6037 0 22:08 pts/0 00:00:00 ps -ef
PostgreSQL默认监听端口
在后续章节中进一步讲解相关配置和访问
[root@web103 pgsql]# netstat -natp|grep postgres tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 4432/postgres
发表在 PostgreSQL
评论关闭