解决方法 dropdb: database removal failed: ERROR: database "TDADB" is being accessed by other users
来源:互联网 发布:js控制keyframes 编辑:程序博客网 时间:2024/05/23 10:06
backup/restore TDA database
~#pg_dump TDADB > backup.sql
~#dropdb TDADB
~#createdb TDADB
~#psql TDADB < backup.sql
但是在dropdb的时候一直报dropdb: database removal failed: ERROR: database "TDADB" is being accessed by other users,上网搜了下,
有价值的参考网页
http://www.question-defense.com/2008/11/12/postgres-error-database-dev-is-being-accessed-by-other-users
~ # psql -l
could not find a "psql" to execute
could not find a "psql" to execute
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------------+----------+---------+-------+-----------------------------
TDADB | root | UTF8 | en_US | en_US |
postgres | root | UTF8 | en_US | en_US |
template0 | root | UTF8 | en_US | en_US | =c/root +
| | | | | root=CTc/root
template1 | root | UTF8 | en_US | en_US | =c/root +
| | | | | root=CTc/root
usboxdb | usboxdbuser | UTF8 | en_US | en_US | =Tc/usboxdbuser +
| | | | | usboxdbuser=CTc/usboxdbuser
(5 rows)
/var/log # dropdb TDADB
could not find a "dropdb" to execute
dropdb: database removal failed: ERROR: database "TDADB" is being accessed by other users
DETAIL: There are 1 other session(s) using the database.
/var/log # psql -d TDADB
could not find a "psql" to execute
could not find a "psql" to execute
psql (9.1.9)
Type "help" for help.
TDADB=# SELECT * FROM pg_stat_activity;
datid | datname | procpid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | xact_start | query_start | waiting | current_query
-------+---------+---------+----------+---------+------------------+-------------+-----------------+-------------+-------------------------------+-------------------------------+-------------------------------+---------+------------------------------------------
16384 | TDADB | 17996 | 10 | root | psql | | | -1 | 2013-04-25 11:55:54.100522+07 | 2013-04-25 11:55:54.1334+07 | 2013-04-25 11:55:54.1334+07 | f | select tb_geomap_malemail_logs_refresh()
16384 | TDADB | 23637 | 10 | root | psql | | | -1 | 2013-04-25 12:04:55.610448+07 | 2013-04-25 12:06:06.278803+07 | 2013-04-25 12:06:06.278803+07 | f | SELECT * FROM pg_stat_activity;
(2 rows)
TDADB=# \q
kill掉procpid对应的进程后再dropdb
/var/log # kill -9 17996
/var/log # kill -9 23637
/var/log # psql -l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------------+----------+---------+-------+-----------------------------
postgres | root | UTF8 | en_US | en_US |
template0 | root | UTF8 | en_US | en_US | =c/root +
| | | | | root=CTc/root
template1 | root | UTF8 | en_US | en_US | =c/root +
| | | | | root=CTc/root
usboxdb | usboxdbuser | UTF8 | en_US | en_US | =Tc/usboxdbuser +
| | | | | usboxdbuser=CTc/usboxdbuser
(4 rows)
- 解决方法 dropdb: database removal failed: ERROR: database "TDADB" is being accessed by other users
- database "mydb" is being accessed by other users
- PostgreSQL创建数据库时报错:ERROR: source database "template1" is being accessed by other users
- PostgreSQL创建数据库时报错:ERROR: source database "template1" is being accessed by other users
- PG :template1 is being accessed by other users
- 新建数据库失败,提示"template1" being accessed by other users
- ERROR: SQLite database is malformed 的解决方法
- dpkg: error: dpkg status database is locked by another process 解决方法
- TD: Database.tables is being restored
- dpkg: error: dpkg status database is locked by another process
- dpkg: error: dpkg status database is locked by another process
- dpkg: error: dpkg status database is locked by another process
- dpkg: error: dpkg status database is locked by another process
- dpkg: error: dpkg status database is locked by another process
- dpkg: error: dpkg status database is locked by another process
- dpkg: status database area is locked by another process 解决方法
- Failed to add VMware DC to zone due to : This DC is being managed by other CloudStack deployment.
- SQLiteDatabaseLockedException: database is locked 解决方法
- LigerUi开发中谨慎载入common.css文件!
- 特征点检测学习_2(surf算法)
- 创建php虚拟目录的办法
- java反射机制详解
- Android 4.0 设置全屏修改
- 解决方法 dropdb: database removal failed: ERROR: database "TDADB" is being accessed by other users
- Android各个版本API的区别
- 【示例源码】戳中萌点的HTML5游戏——驴子跳
- SD卡移植
- opencv c++函数 基础8 离散傅立叶变换
- 特征点检测学习_1(sift算法)
- Jython_Java工程调用jython
- Activity-GalleryView
- 黑马程序员---银行调度系统