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
Related
I am new to Postgres and one of my reports that is using select and extracting JSON return the following error.
ERROR: unexpected chunk number 0 (expected 1) for toast value 12599063 in pg_toast_16687
SQL state: XX000
I do not know how to proceed in fixing my query. Any idea?
Run this command:
select reltoastrelid::regclass from pg_class where relname = 'table_name';
Where the table_name is where the error occur. Then check the result if it is the same toast# like pg_toast.pg_toast_XXXXX. Mine happen to be 16687
Then run these commands to reindex:
REINDEX table table_name;
REINDEX table pg_toast.pg_toast_16687;
VACUUM analyze table_name;
That is data corruption:
restore from backup
upgrade to the latest PostgreSQL minor release
check the hardware
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
I attempted the following, but I am receiving an ORA-01950 error
ALTER USER USER1 QUOTA 200M ON NUSERS;
User altered.
GRANT SELECT ON HR.EMPLOYEES TO USER1;
Grant succeeded.
CONN USER1/USER;
Connected.
CREATE TABLE T3 AS SELECT * FROM HR.EMPLOYEES NUSERS;
CREATE TABLE T3 AS SELECT * FROM HR.EMPLOYEES NUSERS
*
ERROR at line 1:
ORA-01950: no privileges on tablespace 'USERS'
You said this: ALTER USER USER1 QUOTA 200M ON NUSERS;
Oracle responded: ORA-01950: no privileges on tablespace 'USERS'
See the big bold N difference?
I am running below mentioned query for creating LOB tablespace but getting error.
Can anyone check why this error is coming.
Query :-
CREATE LOB TABLESPACE RESUMETS IN BLUDB LOG NO CLOSE NO;
Error :-
SQL> CREATE LOB TABLESPACE RESUMETS IN BLUDB LOG NO;
ERROR near line 1:
SQL0104N An unexpected token "CREATE LOB TABLESPACE" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<select>".
Error :-
db2 => CREATE LOB TABLESPACE RESUMETS IN BLUDB LOG NO CLOSE NO
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "CREATE LOB TABLESPACE" was found following
"BEGIN-OF-STATEMENT". Expected tokens may include: "<select>".
SQLSTATE=42601
There is no such thing as a "LOB tablespace" in DB2 for Linux, Unix and Windows. See the CREATE TABLESPACE documentation here.
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.sql.ref.doc/doc/r0000929.html
I am creating Application server in Worklight 6.1 in server with WL db as DB2 which throws below error and fails with the build. The DB2 error mentioned is increase the pagesize of DB2 database. But how to increase the pagesize in DB2.
[configuredatabase] [sql] SQL: CREATE TABLE APP_ACTIVITY_REPORT (ID BIGINT NOT NULL, ACTIVITY CLOB(1M), ACTIVITY_TIMESTAMP TIMESTAMP, ADAPTER VARCHAR(254), DEVICE_ID VARCHAR(254), DEVICE_MODEL VARCHAR(254), DEVICE_OS VARCHAR(254), ENVIRONMENT VARCHAR(254), GADGET_NAME VARCHAR(254), GADGET_VERSION VARCHAR(254), IP_ADDRESS VARCHAR(254), PROC VARCHAR(254), SESSION_ID VARCHAR(254), SOURCE VARCHAR(254), USER_AGENT VARCHAR(254), LONGITUDE DOUBLE, LATITUDE DOUBLE, POS_USER_TIME TIMESTAMP(3), WIFI_APS VARCHAR(4000), WIFI_CONNECTED_SSID VARCHAR(32), WIFI_CONNECTED_MAC CHAR(20), WIFI_USER_TIME TIMESTAMP(3), APP_CONTEXT VARCHAR(4000), PRIMARY KEY (ID))
[configuredatabase]
BUILD FAILED
[configuredatabase] C:\Users\ADMINI~1\AppData\Local\Temp\wla6314449573\configure.xml:1927: The following error occurred while executing this line:
[configuredatabase] C:\Users\ADMINI~1\AppData\Local\Temp\wla6314449573\configure.xml:3236: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-286, SQLSTATE=42727, SQLERRMC=16384;ADMIN, DRIVER=4.13.127
The instructions for creating the worklight database with the 32K pagesize are at this link . The Worklight version is higher but the Db2 details for creating the database are the same. To drop your existing database use (on Microsoft Windows) , terminate all Worklight applications and services, then Start > Run > db2cwadmin.bat > db2 drop database wladmin. You can then recreate the database with the 32K pagesize.
If you don't want to drop your current database, you can also manually create a 32k pagesize bufferpool with the create bufferpool statement, and then manually create a 32k pagesize tablespace using the create tablespace statement and associating it with the 32k bufferpool. Refer to the online Db2 Knowledge Center for details of those statements. However, the best approach is to drop and recreate the database to avoid potential problems during upgrades of Worklight.
If page size is a problem, you will need to drop the database and recreate with a page file size of at least 32k(this seems to be the acceptable minimum) This is more of a db2 issue rather than a mobilefirst problem.
You can do the following from a db2 console :
db2 => list tablespaces show detail
and look for:
Page size (bytes) = 32768
Hope this helps.