0% found this document useful (0 votes)
8 views3 pages

GGCMD 2

The document contains SQL commands for creating and altering database tables, describing tables, truncating and dropping tables, and selecting counts of records from tables. It also includes commands for replicating data between databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

GGCMD 2

The document contains SQL commands for creating and altering database tables, describing tables, truncating and dropping tables, and selecting counts of records from tables. It also includes commands for replicating data between databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

CREATE TABLE backend_user_preferences (

group_ VARCHAR2(50 CHAR) NOT NULL,


id NUMBER(10,0) GENERATED BY DEFAULT ON NULL AS IDENTITY START WITH 0 INCREMENT
BY 1 MINVALUE 0 NOMAXVALUE ,
item VARCHAR2(150 CHAR) NOT NULL,
namespace VARCHAR2(100 CHAR) NOT NULL,
user_id NUMBER(10,0) NOT NULL,
value CLOB
);

ALTER TABLE backend_user_preferences


ADD CONSTRAINT PRIMARY_141 PRIMARY KEY
(
id
)
ENABLE
;

desc backend_user_preferences

drop table backend_user_preferences cascade constraints;

CREATE TABLE backend_user_preferences (


id NUMBER(10) GENERATED BY DEFAULT ON NULL AS IDENTITY START WITH 0 INCREMENT BY
1 MINVALUE 0 NOMAXVALUE ,
user_id NUMBER(10) NOT NULL,
namespace VARCHAR2(100) NOT NULL,
groupn VARCHAR2(50) NOT NULL,
item VARCHAR2(150) NOT NULL,
value CLOB
);

select * from backend_user_preferences;

desc user_segments

select distinct segment_type from user_segments;

select SEGMENT_NAME, BYTES/1024/1024 from user_segments where SEGMENT_TYPE =


'TABLE' order by 1 desc;

truncate table jacob_logbook_logs;

desc jacob_logbook_logs

alter table jacob_logbook_logs modify MODEL_KEY VARCHAR2(191) NULL

drop table jacob_logbook_logs cascade constraints

CREATE TABLE system_event_logs (


id NUMBER(10,0) GENERATED BY DEFAULT ON NULL AS IDENTITY START WITH 0 INCREMENT
BY 1 MINVALUE 0 NOMAXVALUE ,
level1 VARCHAR2(191 CHAR),
message CLOB,
details CLOB,
created_at DATE,
updated_at DATE
);

ALTER TABLE system_event_logs


ADD CONSTRAINT PRIMARY_113 PRIMARY KEY
(
id
)
ENABLE
;

CREATE TABLE jacob_logbook_logs (


id NUMBER(10,0) GENERATED BY DEFAULT ON NULL AS IDENTITY START WITH 0 INCREMENT
BY 1 MINVALUE 0 NOMAXVALUE ,
model VARCHAR2(191 CHAR) NOT NULL,
model_key VARCHAR2(191 CHAR) NOT NULL,
backend_user_id NUMBER(10,0),
backend_user_name VARCHAR2(191 CHAR),
changes CLOB NOT NULL,
sites CLOB NOT NULL,
created_at DATE,
updated_at DATE
);

ALTER TABLE jacob_logbook_logs


ADD CONSTRAINT PRIMARY_8 PRIMARY KEY
(
id
)
ENABLE
;

mysql> select count(*) from np_backend.system_event_logs;


+----------+
| count(*) |
+----------+
| 10 61 62 86 |
+----------+
1 row in set (5 min 46.86 sec)

84 19 46 2

39 44 00 0

mysql> select count(*) from np_backend.jacob_logbook_logs;


+----------+
| count(*) |
+----------+
| 17 16 91 4 |
+----------+

84 19 46 2
15 25 83 9
1 row in set (32.05 sec)

-- Replicat group name


REPLICAT deliv
-- Replicat database user login, with alias to credentials in the credential store
USERIDALIAS ogg2
-- Error handling rules
REPERROR DEFAULT, ABEND
-- Ignore INSERT operations
IGNOREINSERTS
-- MAP statement to map source objects to target objects and
-- specify column mapping
MAP "fin"."accTAB", TARGET "fin"."accTAB",
COLMAP ("Account" = "Acct",
"Balance" = "Bal",
"Branch" = "Branch");
-- Get INSERT operations
GETINSERTS
-- MAP statement to map source objects to target objects and
-- filter to apply only the 'NY' branch data.
MAP "fin"."teller", TARGET "fin"."tellTAB",
WHERE ("Branch" = 'NY');

You might also like