After install IBM data server, i have one administrator user. I log this user into win 10.
db2 => create database sss (successful)
db2 => connect to sss
db2 => restore database sss from d:\
Drive D: has backup file. I also used create database sss to make database before. When i backup, i let backup file in drive D:. But i get error :
SQL2523W Warning! Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version. The Roll-forward recovery logs
associated with the target database will be deleted.
Do you want to continue ? (y/n) y
SQL1051N The path "E:" does not exist or is not valid. SQLSTATE=57019
What is Drive E:. I never used that drive E:
My test.clp :
UPDATE COMMAND OPTIONS USING S ON Z ON SSS_NODE0000.out V ON;
SET CLIENT ATTACH_MEMBER 0;
SET CLIENT CONNECT_MEMBER 0;
RESTORE DATABASE SSS
-- USER <username>
-- USING '<password>'
FROM 'd:\'
TAKEN AT 20210603080520
-- ON 'E:'
-- DBPATH ON '<target-directory>'
INTO SSS
-- NEWLOGPATH 'E:\DB2\NODE0000\SQL00002\LOGSTREAM0000\'
-- WITH <num-buff> BUFFERS
-- BUFFER <buffer-size>
-- REPLACE HISTORY FILE
-- REPLACE EXISTING
REDIRECT
-- PARALLELISM <n>
WITHOUT ROLLING FORWARD
-- WITHOUT PROMPTING
;
-- ** storage group definition
-- ** Default storage group ID = 0
-- ** Number of storage groups = 1
-- ** Storage group name = IBMSTOGROUP
-- ** Storage group ID = 0
-- ** Data tag = None
-- -- SET STOGROUP PATHS FOR IBMSTOGROUP
-- ON 'E:'
-- ;
-- ** table space definition
-- ** Tablespace name = SYSCATSPACE
-- ** Tablespace ID = 0
-- ** Tablespace Type = Database managed
space
-- ** Tablespace Content Type = All permanent
data. Regular table space.
-- ** Tablespace Page size (bytes) = 4096
-- ** Tablespace Extent size (pages) = 4
-- ** Using automatic storage = Yes
-- ** Storage group ID = 0
-- ** Source storage group ID = -1
-- ** Data tag = None
-- ** Auto-resize enabled = Yes
-- ** Total number of pages = 32768
-- ** Number of usable pages = 32764
-- ** High water mark (pages) = 31016
-- ** Tablespace name = TEMPSPACE1
-- ** Tablespace ID = 1
-- ** Tablespace Type = System managed
space
-- ** Tablespace Content Type = System Temporary
data
-- ** Tablespace Page size (bytes) = 4096
-- ** Tablespace Extent size (pages) = 32
-- ** Using automatic storage = Yes
-- ** Total number of pages = 1
-- ** Tablespace name = USERSPACE1
-- ** Tablespace ID = 2
-- ** Tablespace Type = Database managed
space
-- ** Tablespace Content Type = All permanent
data. Large table space.
-- ** Tablespace Page size (bytes) = 4096
-- ** Tablespace Extent size (pages) = 32
-- ** Using automatic storage = Yes
-- ** Storage group ID = 0
-- ** Source storage group ID = -1
-- ** Data tag = -1
-- ** Auto-resize enabled = Yes
-- ** Total number of pages = 8192
-- ** Number of usable pages = 8160
-- ** High water mark (pages) = 544
-- ** Tablespace name = SYSTOOLSPACE
-- ** Tablespace ID = 3
-- ** Tablespace Type = Database managed
space
-- ** Tablespace Content Type = All permanent
data. Large table space.
-- ** Tablespace Page size (bytes) = 4096
-- ** Tablespace Extent size (pages) = 4
-- ** Using automatic storage = Yes
-- ** Storage group ID = 0
-- ** Source storage group ID = -1
-- ** Data tag = -1
-- ** Auto-resize enabled = Yes
-- ** Total number of pages = 8192
-- ** Number of usable pages = 8188
-- ** High water mark (pages) = 152
-- ** start redirected restore
RESTORE DATABASE SSS CONTINUE;
-- ** end of file
D:>db2 -tvf d:\test.clp
UPDATE COMMAND OPTIONS USING S ON Z ON SSS_NODE0000.out V ON
DB20000I The UPDATE COMMAND OPTIONS command completed successfully.
SET CLIENT ATTACH_MEMBER 0
DB20000I The SET CLIENT command completed successfully.
SET CLIENT CONNECT_MEMBER 0
DB20000I The SET CLIENT command completed successfully.
RESTORE DATABASE SSS FROM 'd:' TAKEN AT 20210603080520 INTO SSS REDIRECT WITHOUT ROLLING FORWARD
SQL2523W Warning! Restoring to an existing database that is different from
the database on the backup image, but have matching names. The target database
will be overwritten by the backup version. The Roll-forward recovery logs
associated with the target database will be deleted.
Do you want to continue ? (y/n) y
SQL1277W A redirected restore operation is being performed. During a table
space restore, only table spaces being restored can have their paths
reconfigured. During a database restore, storage group storage paths and DMS
table space containers can be reconfigured.
DB20000I The RESTORE DATABASE command completed successfully.
RESTORE DATABASE SSS CONTINUE
SQL1051N The path "E:" does not exist or is not valid. SQLSTATE=57019
Related
Can someone suggest me what is the problem, why I am not able to enable integrity, although no constraint found with name of CATEGORY.
create function FCOK_ACCOUNT_CATEGORY_C2(xmlrecord XML) returns integer language sql contains sql no external action deterministic return xmlcast(xmlquery('$d/row/c2' passing xmlrecord as "d") as integer);
reorg table FCOK_ACCOUNT_TEST inplace
db2pd -db admindb –reorg
Database Member 0 -- Database ADMINDB -- Active -- Up 10 days 03:14:17 -- Date 2021-07-26-19.28.05.648688
Table Reorg Information:
Address TbspaceID TableID PartID MasterTbs MasterTab TableName Type IndexID TempSpaceID
0x0A001F00174DF588 4 21566 n/a n/a n/a FCOK_ACCOUNT Offline 0 4
0x0A001F0027981508 3 26880 n/a n/a n/a FCOK_ACCOUNT_TEST Online 0 3
Table Reorg Stats:
Address TableName Start End PhaseStart MaxPhase Phase CurCount MaxCount Status Completion
0x0A001F00174DF588 FCOK_ACCOUNT 07/16/2021 18:38:46 07/16/2021 18:43:15 07/16/2021 18:39:40 3 IdxRecreat 0 0 Done 0
0x0A001F0027981508 FCOK_ACCOUNT_TEST 07/26/2021 18:13:16 07/26/2021 18:14:38 n/a n/a n/a 0 0 Done 0
bash-4.2$
set integrity for FCOK_ACCOUNT_TEST off;
ALTER TABLE FCOK_ACCOUNT_TEST ADD CATEGORY INTEGER generated always as (FCOK_ACCOUNT_CATEGORY_C2(XMLRECORD))
set integrity for FCOK_ACCOUNT_TEST immediate checked;
db2 "set integrity for DB2ADMIN.FCOK_ACCOUNT_TEST immediate checked"
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL3603N Integrity processing through the SET INTEGRITY statement has found
an integrity violation involving a constraint, a unique index, a generated
column, or an index over an XML column. The associated object is identified by
"DB2ADMIN.FCOK_ACCOUNT_TEST.CATEGORY". SQLSTATE=23514
bash-4.2$
bash-4.2$ db2 "select TYPE, ENFORCED from SYSCAT.TABCONST where CONSTNAME='CATEGORY'"
TYPE ENFORCED
0 record(s) selected.
bash-4.2$ db2 "select COLSEQ,COLNAME from SYSCAT.KEYCOLUSE where CONSTNAME='CATEGORY'"
COLSEQ COLNAME
0 record(s) selected.
bash-4.2$ db2 "reorg table db2admin.FCOK_ACCOUNT_TEST inplace"
SQL0668N Operation not allowed for reason code "1" on table
"DB2ADMIN.FCOK_ACCOUNT_TEST". SQLSTATE=57016
Hi I am trying to run oracle db 12 on k8s, with a persistent volume, but it's throwing the error below. please what I am missing
I have created a pv/pvc, mount path /opt/oracle/oradata
permissions to uid 54321 are provided
Listener Log File /opt/oracle/diag/tnslsnr/oracledb-c6867b8cf-v6bnf/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully
[WARNING] [DBT-10328] Specified GDB Name (ORCLCDB) may have a potential conflict with an already existing database on the system.
ACTION: Specify a different GDB Name that does not conflict with existing databases on the system.
[FATAL] [DBT-10317] Specified SID Name (ORCLCDB) already exists.
ACTION: Specify a different SID Name that does not already exist.
SQL> ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCLCDB/control01.ctl' scope=spfile
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> BEGIN DBMS_XDB_CONFIG.SETGLOBALPORTENABLED (TRUE); END;
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> Disconnected
mv: cannot stat '/opt/oracle/product/12.2.0.1/dbhome_1/dbs/spfileORCLCDB.ora': No such file or directory
mv: cannot stat '/opt/oracle/product/12.2.0.1/dbhome_1/dbs/orapwORCLCDB': No such file or directory
The Oracle base remains unchanged with value /opt/oracle
#####################################
########### E R R O R ###############
DATABASE SETUP WAS NOT SUCCESSFUL!
Please check output for further info!
########### E R R O R ###############
please what I am missing. can be related to env
where can I find more logs
Preconditions:
Win7 OS
few disks (may be RAM-disks) for EdiskTablespace, FdiskTablespace,
...
DB1#EdiskTablespace; DB1 populated with some data (no matter what kind)
FdiskTablespace - empty
1) Review 'EdiskTablespace' physical storage space at corresponding folder/disk
2) Execute:
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'DB1' AND pid <> pg_backend_pid();
CREATE DATABASE "DB2"
WITH TEMPLATE "DB1"
TABLESPACE "FdiskTablespace"
;
3) Review again originated 'EdiskTablespace' physical storage space at corresponding folder/disk.
Actual:
Originated 'EdiskTablespace' tablespace disk space rises.
Is it expected behavior while creating DB with template to new tablespace, but initial tablespace rises???
Tested on PG10,11,12
I am looking for a solution to make a copy of a DB2 databaseusing Toad.
I have tried the db2move command like this:
db2move sample COPY -sn BASESAT -co target_db schema_map "((BASESAT,BASESAT4))" -u SATURNE
BASESAT is my database and BASESAT4 is the copy I want to create
I get this error:
When I tried on command mode. I got this
Maybe this could help you.
to create a sample database;
user#host:/home/db2inst1:>db2 "create db sampledb"
DB20000I The CREATE DATABASE command completed successfully.
user#host:/home/db2inst1:>db2 connect to sampledb
Database Connection Information
Database server = DB2
SQL authorization ID = DB2INST1
Local database alias = SAMPLEDB
sample table;
user#host:/home/db2inst1:>db2 "CREATE TABLE SAMPLETABLE (COL1 CHAR(6) NOT NULL, COL2 VARCHAR(24) NOT NULL)"
DB20000I The SQL command completed successfully.
insert an dummy row;
user#host:/home/db2inst1:>db2 "insert into SAMPLETABLE VALUES ('test1','test2')"
DB20000I The SQL command completed successfully.
this is export;
user#host:/home/db2inst1:>mkdir data
user#host:/home/db2inst1:>cd data/
user#host:/home/db2inst1/data:>db2move sampledb export
Application code page not determined, using ANSI codepage 819
***** DB2MOVE *****
Action: EXPORT
Start time: Mon Jul 18 17:49:49 2016
Connecting to database SAMPLEDB ... successful! Server : DB2 Common Server V10.5.7
EXPORT: 147 rows from table "SYSTOOLS"."HMON_ATM_INFO"
EXPORT: 0 rows from table "SYSTOOLS"."HMON_COLLECTION"
EXPORT: 5 rows from table "SYSTOOLS"."POLICY"
EXPORT: 1 rows from table "DB2INST1"."SAMPLETABLE"
Disconnecting from database ... successful!
End time: Mon Jul 18 17:49:49 2016
to generate ddls.
user#host:/home/db2inst1/data:>db2look -d sampledb -e -a -o db2look.sql
-- Generate statistics for all creators
-- Creating DDL for table(s)
-- Output is sent to file: db2look.sql
-- Binding package automatically ...
-- Bind is successful
-- Binding package automatically ...
-- Bind is successful
user#host:/home/db2inst1/data:>db2 terminate
DB20000I The TERMINATE command completed successfully.
this is second database.
user#host:/home/db2inst1/data:>db2 "create db copydb"
DB20000I The CREATE DATABASE command completed successfully.
user#host:/home/db2inst1/data:>db2 "connect to copydb"
Database Connection Information
Database server = DB2
SQL authorization ID = DB2INST1
Local database alias = COPYDB
change database name in db2look as below
CONNECT TO COPYDB;
user#host:/home/db2inst1/data:>db2 -tvf db2look.sql
CONNECT TO COPYDB
Database Connection Information
Database server = DB2
SQL authorization ID = DB2INST1
Local database alias = COPYDB
CREATE SCHEMA "DB2INST1"
DB20000I The SQL command completed successfully.
CREATE TABLE "DB2INST1"."SAMPLETABLE" ( "COL1" CHAR(6 OCTETS) NOT NULL , "COL2" VARCHAR(24 OCTETS) NOT NULL ) IN "USERSPACE1" ORGANIZE BY ROW
DB20000I The SQL command completed successfully.
COMMIT WORK
DB20000I The SQL command completed successfully.
CONNECT RESET
DB20000I The SQL command completed successfully.
TERMINATE
DB20000I The TERMINATE command completed successfully.
You can also use import instead of load.
user#host:/home/db2inst1/data:>db2move copydb load
Application code page not determined, using ANSI codepage 819
***** DB2MOVE *****
Action: LOAD
Start time: Mon Jul 18 17:57:41 2016
Connecting to database COPYDB ... successful! Server : DB2 Common Server V10.5.7
Binding package automatically ... /home/db2inst1/sqllib/bnd/db2common.bnd ... successful!
Binding package automatically ... /home/db2inst1/sqllib/bnd/db2move.bnd ... successful!
* LOAD: table "SYSTOOLS"."HMON_ATM_INFO"
*** ERROR -3304. Check message file tab1.msg!
*** SQLCODE: -3304 - SQLSTATE:
*** SQL3304N The table does not exist.
* LOAD: table "SYSTOOLS"."HMON_COLLECTION"
*** ERROR -3304. Check message file tab2.msg!
*** SQLCODE: -3304 - SQLSTATE:
*** SQL3304N The table does not exist.
* LOAD: table "SYSTOOLS"."POLICY"
*** ERROR -3304. Check message file tab3.msg!
*** SQLCODE: -3304 - SQLSTATE:
*** SQL3304N The table does not exist.
* LOAD: table "DB2INST1"."SAMPLETABLE"
-Rows read: 1
-Loaded: 1
-Rejected: 0
-Deleted: 0
-Committed: 1
**Error occured -1
Disconnecting from database ... successful!
End time: Mon Jul 18 17:57:43 2016
user#host:/home/db2inst1/data:>db2 "connect to copydb"
Database Connection Information
Database server = DB2
SQL authorization ID = DB2INST1
Local database alias = COPYDB
user#host:/home/db2inst1/data:>db2 "select * from SAMPLETABLE"
COL1 COL2
------ ------------------------
test1 test2
1 record(s) selected.
I got the solution thanks to your help.
Here are the steps if someone else has the same problem:
1-create the database in which to copy (in my case BASESAT2)
2-use db2move in command mode like this:
db2move dbname COPY -sn SCHEMA_OF_YOUR_DBname -co TARGET_DB dbname_copy USER user_name USING password
Here is a screenshot.
I have a question about PostgreSQL's table oid.
I create a table. oid is 24622
(-rw------- 1 postgres postgres 8192 Nov 29 17:45 24622)
and I found also modified files at the same time.
(-rw------- 1 postgres postgres 73728 Nov 29 17:45 12741)
(-rw------- 1 postgres postgres 32768 Nov 29 17:45 12744)
(-rw------- 1 postgres postgres 65536 Nov 29 17:45 12764)
(-rw------- 1 postgres postgres 57344 Nov 29 17:45 12767)
but those tables are not found in same database, no one is found.
ksh2=# select oid,relname from pg_class where oid = '12741';
oid | relname
-----+---------
(0 rows)
How can I find those tables???
(I also change schema, and try to find, but no one is found)
Thank you.
A filename doesn't necessarily correspond with oid:
Note that while a table's filenode often matches its OID, this is not
necessarily the case; some operations, like TRUNCATE, REINDEX, CLUSTER
and some forms of ALTER TABLE, can change the filenode while
preserving the OID.
The filename is stored in the relfilenode column:
Name of the on-disk file of this relation; zero means this is a
"mapped" relation whose disk file name is determined by low-level
state
So try searching for the relfilenode:
select name, relkind from pg_class where relfilenode = 12741;
The relkind column tells you what type of object the file represents:
r = ordinary table
i = index
S = sequence
v = view
c = composite type
t = TOAST table
f = foreign table