ISSUE:
when I tried to change the Netezza DB name,it throws the below error and did not allow to rename.
SYSTEM(ADMIN)=> alter database NZDB1 rename to NZDB1_old;
ERROR: ALTER DATABASE: database "NZDB1" is being accessed by other users
SYSTEM(ADMIN)=> \q
nz@NZ_server_name:/export/home/nz> nzsession
ID Type User Start Time PID Database State Priority Name Client IP Client PID Command
----- -------- --------- ----------------------- ----- -------- ------ ------------- -------------- ---------- ------------------------
62849 sql-odbc NZUSER 02-Mar-18, 03:45:18 EST 14040 NZDB1 idle normal 10.128.211.171 7716 SHOW ENABLE_ROW_SECURITY
92451 sql ADMIN 15-Mar-18, 16:01:35 EDT 6134 SYSTEM active normal 127.0.0.1 6133 SELECT session_id, clien
Solution:
checked the session associated with DB and cleared it and rename the DB ,it went fine.
nz@NZ_server_name:/export/home/nz> nzsession abort -id 62849 -force
nz@NZ_server_name:/export/home/nz> nzsession
ID Type User Start Time PID Database State Priority Name Client IP Client PID Command
----- ---- ----- ----------------------- ----- -------- ------ ------------- --------- ---------- ------------------------
92454 sql ADMIN 15-Mar-18, 16:02:36 EDT 10149 SYSTEM active normal 127.0.0.1 10148 SELECT session_id, clien
nz@NZ_server_name:/export/home/nz> nzsql
Welcome to nzsql, the IBM Netezza SQL interactive terminal.
Type: \h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
SYSTEM(ADMIN)=> alter database NZDB1 rename to NZDB1_old;
ALTER DATABASE
SYSTEM(ADMIN)=> alter database NZDB1_NEW rename to NZDB1;
ALTER DATABASE
SYSTEM(ADMIN)=> \l
List of databases
DATABASE | OWNER
------------------------------+---------
NZDB1 | ADMIN
NZDB1_OLD | ADMIN
No comments:
Post a Comment