DBA Hub

📋Steps in this guide1/5

Obey command in goldengate oracle DBACLASS

Like we execute .sql file against SQL, we can write multiple goldengate commands inside a .oby file and execute it against GGSCI prompt using OBEY command. EXAMPLE: In the below example, we will add supplemental login(add trandata) for multiple tables using obey command. 1. Create a text file and put goldengate commands. vi addtran.oby dblogin USERID […]

oracle replicationintermediate
by OracleDba
16 views
1

EXAMPLE:

In the below example, we will add supplemental login(add trandata) for multiple tables using obey command. 1. Create a text file and put goldengate commands. 2. execute obey command from GGSCI SYNTAX – obey < text_file_name.oby> ggsci> obey addtran.oby We can see, it executed all the commands mentioned inside the text file.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
vi addtran.oby

dblogin USERID ggate, PASSWORD ggate123
add trandata dbaclass.TEST3
add trandata dbaclass.TEST4

./ggsci

GGSCI > obey addtran.oby

GGSCI > dblogin USERID ggate, PASSWORD ggate123

Successfully logged into database.

GGSCI > add trandata dbaclass.TEST3


2017-07-17 11:24:29  WARNING OGG-06439  No unique key is defined for table TEST3. 

Logging of supplemental redo data enabled for table DBACLASS.TEST3.
TRANDATA for scheduling columns has been added on table 'DBACLASS.TEST3'.
TRANDATA for instantiation CSN has been added on table 'DBACLASS.TEST3'.

GGSCI  4> add trandata dbaclass.TEST4


2017-07-17 11:24:33  WARNING OGG-06439  No unique key is defined for table TEST4. 

Logging of supplemental redo data enabled for table DBACLASS.TEST4.
TRANDATA for scheduling columns has been added on table 'DBACLASS.TEST4'.
TRANDATA for instantiation CSN has been added on table 'DBACLASS.TEST4'.
2

NESTED OBEY:

Can we put one obey file inside another obey file.?? Well this nested obey is controlled by the keyword ALLOWNESTED.
3

NOALLOWNESTED:

This is the default setting. Any attempt to run nested obey file will throw below error. ERROR: Nested OBEY scripts not allowed. Use ALLOWNESTED to allow nested scripts.
4

ALLOWNESTED:

This parameter Enables the use of nested OBEY files. i.e we can use one obey file inside another obey file.
5

Step 5

Let’s create two obey files: Let’s try with the default one(NOALLOWNESTED) Here I have created two obey files and put them inside another obey file Execute the obey file As expected it is throwing error, Now let’s use ALLOWNESTED parameter: Execute the obey file: With ALLOWNESTED, obey file executed successfully. The maximum number of nested levels is 16.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--- obey file 1 

cat infotran1.oby

dblogin USERID ggate, PASSWORD ggate123
info trandata dbaclass.TEST3


--- obey file 2 
cat infotran2.oby

dblogin USERID ggate, PASSWORD ggate123
info trandata dbaclass.TEST4

cat infotran.oby

obey infotran1.oby
obey infotran2.oby

GGSCI > obey infotran1.oby

ERROR: Nested OBEY scripts not allowed. Use ALLOWNESTED to allow nested scripts.

cat infotran.oby

ALLOWNESTED
obey infotran1.oby
obey infotran2.oby

GGSCI > obey infotran.oby

GGSCI > ALLOWNESTED

Nested OBEY scripts allowed.

GGSCI > obey infotran1.oby

**** Halting script [infotran.oby], starting script [infotran1.oby]...

GGSCI > dblogin USERID ggate, PASSWORD ggate123

Successfully logged into database.

GGSCI > info trandata dbaclass.TEST3


Logging of supplemental redo log data is enabled for table DBACLASS.TEST3.

Columns supplementally logged for table DBACLASS.TEST3: CREATED, DATA_OBJECT_ID, EDITION_NAME, GENERATED, LAST_DDL_TIME, NAMESPACE, OBJECT_ID, OBJECT_NAME, OBJECT_TYPE, OWNER, SECONDARY, STATUS, SU
BOBJECT_NAME, TEMPORARY, TIMESTAMP.

Prepared CSN for table DBACLASS.TEST3: 11733401025760
GGSCI  6>

GGSCI  6> **** Terminating script [infotran1.oby], resuming script [infotran.oby]...

GGSCI  6> obey infotran2.oby

**** Halting script [infotran.oby], starting script [infotran2.oby]...

GGSCI > dblogin USERID ggate, PASSWORD ggate123

Successfully logged into database.

GGSCI > info trandata dbaclass.TEST4


Logging of supplemental redo log data is enabled for table DBACLASS.TEST4.

Columns supplementally logged for table DBACLASS.TEST4: CREATED, DATA_OBJECT_ID, EDITION_NAME, GENERATED, LAST_DDL_TIME, NAMESPACE, OBJECT_ID, OBJECT_NAME, OBJECT_TYPE, OWNER, SECONDARY, STATUS, SU
BOBJECT_NAME, TEMPORARY, TIMESTAMP.

Prepared CSN for table DBACLASS.TEST4: 11733401025806
GGSCI >

GGSCI > **** Terminating script [infotran2.oby], resuming script [infotran.oby]...

Comments (0)

Please to add comments

No comments yet. Be the first to comment!