File: rollForwardBackup.out

package info (click to toggle)
derby 10.14.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 78,896 kB
  • sloc: java: 691,930; sql: 42,686; xml: 20,511; sh: 3,373; sed: 96; makefile: 60
file content (882 lines) | stat: -rw-r--r-- 29,628 bytes parent folder | download | duplicates (4)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
ij> --
--   Licensed to the Apache Software Foundation (ASF) under one or more
--   contributor license agreements.  See the NOTICE file distributed with
--   this work for additional information regarding copyright ownership.
--   The ASF licenses this file to You under the Apache License, Version 2.0
--   (the "License"); you may not use this file except in compliance with
--   the License.  You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
--   Unless required by applicable law or agreed to in writing, software
--   distributed under the License is distributed on an "AS IS" BASIS,
--   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--   See the License for the specific language governing permissions and
--   limitations under the License.
--
CREATE PROCEDURE RENAME_FILE(LOCATION VARCHAR(32000), NAME VARCHAR(32000), NEW_NAME  VARCHAR(32000)) DYNAMIC RESULT SETS 0 LANGUAGE JAVA EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.FTFileUtil.renameFile' PARAMETER STYLE JAVA;
0 rows inserted/updated/deleted
ij> values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.storage.logArchiveMode');
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
NULL                                                                                                                            
ij> --check whether log archive mode  enabling method is working
call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 0);
0 rows inserted/updated/deleted
ij> values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.storage.logArchiveMode');
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
true                                                                                                                            
ij> --check whether the logArchive Mode is persistent across boots
disconnect;
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> connect 'wombat';
ij> values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.storage.logArchiveMode');
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
true                                                                                                                            
ij> --check whether log archive mode  disabling method is working
call SYSCS_UTIL.SYSCS_DISABLE_LOG_ARCHIVE_MODE(1);
0 rows inserted/updated/deleted
ij> values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.storage.logArchiveMode');
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
false                                                                                                                           
ij> --check whether the logArchive Mode disabling persistent across boots
disconnect;
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> connect 'wombat';
ij> values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.storage.logArchiveMode');
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
false                                                                                                                           
ij> -- reenable the log archive mode again to see whether the 
-- disabling has any side effects.
call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 0);
0 rows inserted/updated/deleted
ij> values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.storage.logArchiveMode');
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
true                                                                                                                            
ij> disconnect;
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> connect 'wombat';
ij> values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.storage.logArchiveMode');
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
true                                                                                                                            
ij> --END OF PROPERTY ARCHIVE CHECKS
---PERFORM DIFFERENT TYPES OF RESTORE
create table t1(a int ) ;
0 rows inserted/updated/deleted
ij> insert into t1 values(1) ;
1 row inserted/updated/deleted
ij> insert into t1 values(2) ;
1 row inserted/updated/deleted
ij> insert into t1 values(3 ) ;
1 row inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 0);
0 rows inserted/updated/deleted
ij> insert into t1 values(4) ;
1 row inserted/updated/deleted
ij> insert into t1 values(5);
1 row inserted/updated/deleted
ij> insert into t1 values(6);
1 row inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --performa rollforward recovery
connect 'wombat;rollForwardRecoveryFrom=extinout/mybackup/wombat';
ij> select * from t1 ;
A          
-----------
1          
2          
3          
4          
5          
6          
ij> insert into t1 values(7);
1 row inserted/updated/deleted
ij> insert into t1 values(8);
1 row inserted/updated/deleted
ij> insert into t1 values(9);
1 row inserted/updated/deleted
ij> --take a backup again
call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 1);
0 rows inserted/updated/deleted
ij> insert into t1 values(10);
1 row inserted/updated/deleted
ij> insert into t1 values(11);
1 row inserted/updated/deleted
ij> insert into t1 values(12);
1 row inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --perform complete version restore
connect 'wombat;restoreFrom=extinout/mybackup/wombat';
ij> select * from t1 ;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
ij> insert into t1 values(10);
1 row inserted/updated/deleted
ij> insert into t1 values(11);
1 row inserted/updated/deleted
ij> insert into t1 values(12);
1 row inserted/updated/deleted
ij> insert into t1 values(13);
1 row inserted/updated/deleted
ij> insert into t1 values(14);
1 row inserted/updated/deleted
ij> insert into t1 values(15);
1 row inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 1);
0 rows inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --create a new database using wombat db backup copy with a different database name
connect 'wombat1;createFrom=extinout/mybackup/wombat';
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
ij> insert into t1 values(16);
1 row inserted/updated/deleted
ij> insert into t1 values(17);
1 row inserted/updated/deleted
ij> insert into t1 values(18);
1 row inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 1);
0 rows inserted/updated/deleted
ij> connect 'wombat1;shutdown=true';
ERROR 08006: Database 'wombat1' shutdown.
ij> disconnect;
ij> ---BACKUP AND RESTORE USING LOGDEVICE.
connect 'crwombat;createFrom=extinout/mybackup/wombat;logDevice=extinout/crwombatlog';
ij> values SUBSTR(SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice'), LOCATE('crwombatlog',SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')),11);
1          
-----------
crwombatlog
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
ij> insert into t1 values(19);
1 row inserted/updated/deleted
ij> insert into t1 values(20);
1 row inserted/updated/deleted
ij> insert into t1 values(21);
1 row inserted/updated/deleted
ij> connect 'crwombat;shutdown=true';
ERROR 08006: Database 'crwombat' shutdown.
ij> disconnect;
ij> --do a plain boot , we should have the log device specified earlier.
connect 'crwombat';
ij> values SUBSTR(SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice'), LOCATE('crwombatlog',SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')),11);
1          
-----------
crwombatlog
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
ij> insert into t1 values(22);
1 row inserted/updated/deleted
ij> insert into t1 values(23);
1 row inserted/updated/deleted
ij> insert into t1 values(24);
1 row inserted/updated/deleted
ij> connect 'crwombat;shutdown=true';
ERROR 08006: Database 'crwombat' shutdown.
ij> disconnect;
ij> ---check the error case of log device only existing when
-- we try to do createFrom .
--following connection shoul fail.
connect 'erwombat;createFrom=extinout/mybackup/wombat;logDevice=extinout/crwombatlog';
ERROR XJ040: Failed to start database 'erwombat' with class loader XXXX,  see the next exception for details.
ERROR XSLAT: The log directory 'extinout<ps>crwombatlog<ps>log' exists. The directory might belong to another database. Check that the location specified for the logDevice attribute is correct.
ij> connect 'wombat;restoreFrom=extinout/mybackup/wombat;logDevice=extinout/wombatlog';
ij> values SUBSTR(SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice'), LOCATE('wombatlog',SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')),9);
1        
---------
wombatlog
ij> select * from t1 ;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
ij> insert into t1 values(19);
1 row inserted/updated/deleted
ij> insert into t1 values(20);
1 row inserted/updated/deleted
ij> insert into t1 values(21);
1 row inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 1);
0 rows inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --restore again from backup case to make sure
--backups are getting the log device property.	
connect 'wombat;restoreFrom=extinout/mybackup/wombat';
ij> values SUBSTR(SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice'), LOCATE('wombatlog',SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')),9);
1        
---------
wombatlog
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
ij> insert into t1 values(22);
1 row inserted/updated/deleted
ij> insert into t1 values(23);
1 row inserted/updated/deleted
ij> insert into t1 values(24);
1 row inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --do a vannila boot and see the device to make sure the log device is still intact.
connect 'wombat';
ij> values SUBSTR(SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice'), LOCATE('wombatlog',SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')),9);
1        
---------
wombatlog
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
22         
23         
24         
ij> autocommit off;
ij> insert into t1 values(25);
1 row inserted/updated/deleted
ij> insert into t1 values(26);
1 row inserted/updated/deleted
ij> insert into t1 values(27);
1 row inserted/updated/deleted
ij> rollback;
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --performa rollforward recovery with logDevice specified at backup
connect 'wombat;rollForwardRecoveryFrom=extinout/mybackup/wombat';
ij> values SUBSTR(SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice'), LOCATE('wombatlog',SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')),9);
1        
---------
wombatlog
ij> select * from t1 ;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
22         
23         
24         
ij> insert into t1 values(25);
1 row inserted/updated/deleted
ij> insert into t1 values(26);
1 row inserted/updated/deleted
ij> insert into t1 values(27);
1 row inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --perform a rollforward recovery with log device is moved
--to some other place than what it was when backup was taken.
--move the log to different dir name.
connect 'dummycondb;createFrom=extinout/mybackup/wombat;logDevice=extinout/wombatlog1';
ij> call RENAME_FILE(null,'extinout/wombatlog','extinout/wombatlogmoved');
0 rows inserted/updated/deleted
ij> disconnect;
ij> connect 'wombat;rollForwardRecoveryFrom=extinout/mybackup/wombat;logDevice=extinout/wombatlogmoved';
ij> values SUBSTR(SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice'), LOCATE('wombatlogmoved',SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')),14);
1             
--------------
wombatlogmoved
ij> select * from t1 ;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
22         
23         
24         
25         
26         
27         
ij> insert into t1 values(30);
1 row inserted/updated/deleted
ij> insert into t1 values(31);
1 row inserted/updated/deleted
ij> insert into t1 values(32);
1 row inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --do a plain boot and verify the log device.
connect 'wombat';
ij> values SUBSTR(SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice'), LOCATE('wombatlogmoved',SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')),14);
1             
--------------
wombatlogmoved
ij> select * from t1 ;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
22         
23         
24         
25         
26         
27         
30         
31         
32         
ij> insert into t1 values(33);
1 row inserted/updated/deleted
ij> insert into t1 values(34);
1 row inserted/updated/deleted
ij> insert into t1 values(35);
1 row inserted/updated/deleted
ij> --take a fresh backup again with moved log device.
call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 1);
0 rows inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --restore and check the results;
connect 'wombat;restoreFrom=extinout/mybackup/wombat';
ij> values SUBSTR(SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice'), LOCATE('wombatlogmoved',SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')),14);
1             
--------------
wombatlogmoved
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
22         
23         
24         
25         
26         
27         
30         
31         
32         
33         
34         
35         
ij> insert into t1 values(36);
1 row inserted/updated/deleted
ij> insert into t1 values(37);
1 row inserted/updated/deleted
ij> insert into t1 values(38);
1 row inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --simulate OS type copy and then boot(Commented because it does not work in nightlies)
--connect 'dummycondb';
--call RENAME_FILE('rollForwardBackup', 'wombat', 'wombat.old');
--call RENAME_FILE(null, 'extinout/mybackup/wombat', 'rollForwardBackup/wombat');
---disconnect;
---connect 'wombat';
--Following SHOULD SHOW NULL value.
--values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice');
--select * from t1;
--call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
--     'extinout/mybackup', 1);
--connect 'wombat;shutdown=true';
--disconnect;
---createFrom without logDevice specified on URL should have null value.
connect 'tempwombat;createFrom=extinout/mybackup/wombat';
ij> values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice');
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
NULL                                                                                                                            
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
22         
23         
24         
25         
26         
27         
30         
31         
32         
33         
34         
35         
ij> insert into t1 values(39);
1 row inserted/updated/deleted
ij> insert into t1 values(40);
1 row inserted/updated/deleted
ij> insert into t1 values(41);
1 row inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 1);
0 rows inserted/updated/deleted
ij> connect 'tempwombat;shutdown=true';
ERROR 08006: Database 'tempwombat' shutdown.
ij> disconnect;
ij> connect 'wombat;restoreFrom=extinout/mybackup/tempwombat';
ij> values SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice');
1                                                                                                                               
--------------------------------------------------------------------------------------------------------------------------------
NULL                                                                                                                            
ij> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 1);
0 rows inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> ---Using plain backup mechanism rstore/recreate db using  restoreFrom/createFrom
connect 'wombat';
ij> call SYSCS_UTIL.SYSCS_DISABLE_LOG_ARCHIVE_MODE(1);
0 rows inserted/updated/deleted
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
22         
23         
24         
25         
26         
27         
30         
31         
32         
33         
34         
35         
39         
40         
41         
ij> insert into t1 values(42);
1 row inserted/updated/deleted
ij> insert into t1 values(43);
1 row inserted/updated/deleted
ij> insert into t1 values(44);
1 row inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE('extinout/mybackup');
0 rows inserted/updated/deleted
ij> --following inserted values should not be there
--when we do restore from the above backup.
insert into t1 values(45);
1 row inserted/updated/deleted
ij> insert into t1 values(46);
1 row inserted/updated/deleted
ij> insert into t1 values(47);
1 row inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> connect 'wombat;restoreFrom=extinout/mybackup/wombat';
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
22         
23         
24         
25         
26         
27         
30         
31         
32         
33         
34         
35         
39         
40         
41         
42         
43         
44         
ij> insert into t1 values(45);
1 row inserted/updated/deleted
ij> insert into t1 values(46);
1 row inserted/updated/deleted
ij> insert into t1 values(47);
1 row inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE('extinout/mybackup');
0 rows inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> connect 'wombatnew;createFrom=extinout/mybackup/wombat';
ij> select * from t1;
A          
-----------
1          
2          
3          
4          
5          
6          
7          
8          
9          
10         
11         
12         
13         
14         
15         
19         
20         
21         
22         
23         
24         
25         
26         
27         
30         
31         
32         
33         
34         
35         
39         
40         
41         
42         
43         
44         
45         
46         
47         
ij> insert into t1 values(48);
1 row inserted/updated/deleted
ij> insert into t1 values(49);
1 row inserted/updated/deleted
ij> insert into t1 values(50);
1 row inserted/updated/deleted
ij> connect 'wombatnew;shutdown=true';
ERROR 08006: Database 'wombatnew' shutdown.
ij> disconnect;
ij> --enable the log archive mode again.
connect 'wombat';
ij> call SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(
    'extinout/mybackup', 1);
0 rows inserted/updated/deleted
ij> connect 'wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> disconnect;
ij> --NEGATIVE TEST with  RESTORE FLAGS
-- with createFrom option should give erro on existing database
connect 'wombat;createFrom=extinout/mybackup/wombat';
ERROR XJ040: Failed to start database 'wombat' with class loader XXXX,  see the next exception for details.
ERROR XBM0J: Directory DBLOCATION/wombat already exists.
ij> -- specify conflictint attributes; it should fail.
connect 'wombat;create=true;createFrom=extinout/mybackup/wombat';
ERROR XJ049: Conflicting create attributes specified.
ij> connect 'wombat;create=true;rollForwardRecoveryFrom=extinout/mybackup/wombat';
ERROR XJ049: Conflicting create attributes specified.
ij> connect 'wombat;create=true;restoreFrom=extinout/mybackup/wombat';
ERROR XJ049: Conflicting create attributes specified.
ij> connect 'wombat;restoreFrom=extinout/mybackup/wombat;rollForwardRecoveryFrom=extinout/mybackup/wombat';
ERROR XJ081: Conflicting create/restore/recovery attributes specified.
ij> connect 'wombat;createFrom=extinout/mybackup/wombat;rollForwardRecoveryFrom=extinout/mybackup/wombat';
ERROR XJ081: Conflicting create/restore/recovery attributes specified.
ij> -- With wrong back up path name it shoud fail.
connect 'wombat;rollForwardRecoveryFrom=nobackup/wombat';
ERROR XJ040: Failed to start database 'wombat' with class loader XXXX,  see the next exception for details.
ERROR XBM0Y: Backup database directory nobackup<ps>wombat not found. Please make sure that the specified backup path is right.
ij> connect 'wombat;restoreFrom=nobackup/wombat';
ERROR XJ040: Failed to start database 'wombat' with class loader XXXX,  see the next exception for details.
ERROR XBM0Y: Backup database directory nobackup<ps>wombat not found. Please make sure that the specified backup path is right.
ij> connect 'wombat2;createFrom=nobackup/wombat';
ERROR XJ040: Failed to start database 'wombat2' with class loader XXXX,  see the next exception for details.
ERROR XBM0Y: Backup database directory nobackup<ps>wombat not found. Please make sure that the specified backup path is right.
ij> --Simulate missing files by renaming some files in backup(like a corrupted backup and check 
--whether we get proper error messages
--Get a connection because it is required to make any calls in ij 
connect 'wombat2;restoreFrom=extinout/mybackup/wombat';
ij> call RENAME_FILE('extinout/mybackup/wombat/','service.properties','service.properties.old');
0 rows inserted/updated/deleted
ij> connect 'wombat;restoreFrom=extinout/mybackup/wombat';
ERROR XJ040: Failed to start database 'wombat' with class loader XXXX,  see the next exception for details.
ERROR XBM0Q: File extinout<ps>mybackup<ps>wombat<ps>service.properties not found. Please make sure that backup copy is the correct one and it is not corrupted.
ij> call RENAME_FILE('extinout/mybackup/wombat/','service.properties.old','service.properties');
0 rows inserted/updated/deleted
ij> call RENAME_FILE('extinout/mybackup/wombat/','log','log.old');
0 rows inserted/updated/deleted
ij> connect 'wombat;restoreFrom=extinout/mybackup/wombat';
ERROR XJ040: Failed to start database 'wombat' with class loader XXXX,  see the next exception for details.
ERROR XSLAS: Log directory extinout<ps>mybackup<ps>wombat<ps>log not found in backup during restore. Please make sure that backup copy is the correct one and it is not corrupted.
ij> call RENAME_FILE('extinout/mybackup/wombat/','log.old','log');
0 rows inserted/updated/deleted
ij> call RENAME_FILE('extinout/mybackup/wombat/','seg0','data.old');
0 rows inserted/updated/deleted
ij> connect 'wombat;restoreFrom=extinout/mybackup/wombat';
ERROR XJ040: Failed to start database 'wombat' with class loader XXXX,  see the next exception for details.
ERROR XSDG6: Data segment directory not found in extinout<ps>mybackup<ps>wombat backup during restore. Please make sure that backup copy is the right one and it is not corrupted.
ij> call RENAME_FILE('extinout/mybackup/wombat/','data.old','seg0');
0 rows inserted/updated/deleted
ij> --try error cases with createFrom;if root created is not getting cleaned up,
--next createFrom call will fail with DBLOCATION/wombat exist error.
call RENAME_FILE('extinout/mybackup/wombat/','service.properties','service.properties.old');
0 rows inserted/updated/deleted
ij> connect 'wombat;createFrom=extinout/mybackup/wombat';
ERROR XJ040: Failed to start database 'wombat' with class loader XXXX,  see the next exception for details.
ERROR XBM0Q: File extinout<ps>mybackup<ps>wombat<ps>service.properties not found. Please make sure that backup copy is the correct one and it is not corrupted.
ij> call RENAME_FILE('extinout/mybackup/wombat/','service.properties.old','service.properties');
0 rows inserted/updated/deleted
ij> call RENAME_FILE('extinout/mybackup/wombat/','log','log.old');
0 rows inserted/updated/deleted
ij> connect 'wombat;createFrom=extinout/mybackup/wombat';
ERROR XJ040: Failed to start database 'wombat' with class loader XXXX,  see the next exception for details.
ERROR XSLAS: Log directory extinout<ps>mybackup<ps>wombat<ps>log not found in backup during restore. Please make sure that backup copy is the correct one and it is not corrupted.
ij> call RENAME_FILE('extinout/mybackup/wombat/','log.old','log');
0 rows inserted/updated/deleted
ij> call RENAME_FILE('extinout/mybackup/wombat/','seg0','data.old');
0 rows inserted/updated/deleted
ij> connect 'wombat;createFrom=extinout/mybackup/wombat';
ERROR XJ040: Failed to start database 'wombat' with class loader XXXX,  see the next exception for details.
ERROR XSDG6: Data segment directory not found in extinout<ps>mybackup<ps>wombat backup during restore. Please make sure that backup copy is the right one and it is not corrupted.
ij> call RENAME_FILE('extinout/mybackup/wombat/','data.old','seg0');
0 rows inserted/updated/deleted
ij> drop procedure RENAME_FILE;
0 rows inserted/updated/deleted
ij>