github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/snapshot/nonsys_restore_to_nonsys_account.sql (about) 1 drop account if exists acc01; 2 create account acc01 admin_name = 'test_account' identified by '111'; 3 4 -- @session:id=1&user=acc01:test_account&password=111 5 drop database if exists test; 6 create database test; 7 use test; 8 create table clu01(col1 int, col2 decimal); 9 insert into clu01 values(1,2); 10 11 drop snapshot if exists sp01; 12 create snapshot sp01 for account acc01; 13 insert into clu01 values(2,3); 14 15 restore account acc01 from snapshot sp01; 16 17 select * from clu01; 18 select count(*) from clu01; 19 drop table clu01; 20 drop database test; 21 drop snapshot sp01; 22 23 24 25 26 -- non-acc01 account restore to non-acc01 account: single db, single table 27 drop database if exists test01; 28 create database test01; 29 use test01; 30 31 drop table if exists rs01; 32 create table rs01 (col1 int, col2 decimal(6), col3 varchar(30)); 33 insert into rs01 values (1, null, 'database'); 34 insert into rs01 values (2, 38291.32132, 'database'); 35 insert into rs01 values (3, null, 'database management acc01tem'); 36 insert into rs01 values (4, 10, null); 37 insert into rs01 values (1, -321.321, null); 38 insert into rs01 values (2, -1, null); 39 select count(*) from rs01; 40 41 drop snapshot if exists sp01; 42 create snapshot sp01 for account acc01; 43 select count(*) from rs01 {snapshot = 'sp01'}; 44 insert into rs01 values (2, -1, null); 45 insert into rs01 values (1, -321.321, null); 46 select * from rs01; 47 48 select count(*) from mo_catalog.mo_tables{snapshot = 'sp01'} where reldatabase = 'test01'; 49 -- @ignore:0,6,7 50 select * from mo_catalog.mo_database{snapshot = 'sp01'} where datname = 'test01'; 51 select attname from mo_catalog.mo_columns{snapshot = 'sp01'} where att_database = 'test01'; 52 restore account acc01 from snapshot sp01; 53 select count(*) from rs01; 54 select * from rs01; 55 select count(*) from rs01 {snapshot = 'sp01'}; 56 select count(*) from mo_catalog.mo_tables{snapshot = 'sp01'} where reldatabase = 'test01'; 57 -- @ignore:0,6,7 58 select * from mo_catalog.mo_database{snapshot = 'sp01'} where datname = 'test01'; 59 select attname from mo_catalog.mo_columns{snapshot = 'sp01'} where att_database = 'test01'; 60 drop snapshot sp01; 61 drop database test01; 62 63 64 65 66 -- non-acc01 account restore to non-acc01 account: single db, multi table 67 drop database if exists test02; 68 create database test02; 69 use test02; 70 drop table if exists rs02; 71 create table rs02 (col1 int, col2 datetime); 72 insert into rs02 values (1, '2020-10-13 10:10:10'); 73 insert into rs02 values (2, null); 74 insert into rs02 values (1, '2021-10-10 00:00:00'); 75 insert into rs02 values (2, '2023-01-01 12:12:12'); 76 insert into rs02 values (2, null); 77 insert into rs02 values (3, null); 78 insert into rs02 values (4, '2023-11-27 01:02:03'); 79 select * from rs02; 80 drop table if exists rs03; 81 create table rs03 (col1 int, col2 float, col3 decimal, col4 enum('1','2','3','4')); 82 insert into rs03 values (1, 12.21, 32324.32131, 1); 83 insert into rs03 values (2, null, null, 2); 84 insert into rs03 values (2, -12.1, 34738, null); 85 insert into rs03 values (1, 90.2314, null, 4); 86 insert into rs03 values (1, 43425.4325, -7483.432, 2); 87 drop snapshot if exists sp02; 88 create snapshot sp02 for account acc01; 89 select count(*) from mo_catalog.mo_tables{snapshot = 'sp02'} where reldatabase = 'test02'; 90 -- @ignore:0,6,7 91 select * from mo_catalog.mo_database{snapshot = 'sp02'} where datname = 'test02'; 92 select attname from mo_catalog.mo_columns{snapshot = 'sp02'} where att_database = 'test02'; 93 94 use test02; 95 insert into rs02 select * from rs02; 96 select count(*) from rs02; 97 select count(*) from rs02{snapshot = 'sp02'}; 98 99 delete from rs03 where col1 = 1; 100 select count(*) from rs03; 101 select count(*) from rs03{snapshot = 'sp02'}; 102 103 restore account acc01 from snapshot sp02; 104 105 show databases; 106 select count(*) from rs02; 107 select count(*) from rs03; 108 use test02; 109 drop table rs02; 110 drop table rs03; 111 drop snapshot sp02; 112 113 114 115 -- table with foreign key restore 116 drop database if exists test03; 117 create database test03; 118 use test03; 119 drop table if exists pri01; 120 create table pri01( 121 deptno int unsigned comment '部门编号', 122 dname varchar(15) comment '部门名称', 123 loc varchar(50) comment '部门所在位置', 124 primary key(deptno) 125 ) comment='部门表'; 126 127 insert into pri01 values (10,'ACCOUNTING','NEW YORK'); 128 insert into pri01 values (20,'RESEARCH','DALLAS'); 129 insert into pri01 values (30,'SALES','CHICAGO'); 130 insert into pri01 values (40,'OPERATIONS','BOSTON'); 131 132 drop table if exists aff01; 133 create table aff01( 134 empno int unsigned auto_increment COMMENT '雇员编号', 135 ename varchar(15) comment '雇员姓名', 136 job varchar(10) comment '雇员职位', 137 mgr int unsigned comment '雇员对应的领导的编号', 138 hiredate date comment '雇员的雇佣日期', 139 sal decimal(7,2) comment '雇员的基本工资', 140 comm decimal(7,2) comment '奖金', 141 deptno int unsigned comment '所在部门', 142 primary key(empno), 143 constraint `c1` foreign key (deptno) references pri01 (deptno) 144 ); 145 146 insert into aff01 values (7369,'SMITH','CLERK',7902,'1980-12-17',800,NULL,20); 147 insert into aff01 values (7499,'ALLEN','SALESMAN',7698,'1981-02-20',1600,300,30); 148 insert into aff01 values (7521,'WARD','SALESMAN',7698,'1981-02-22',1250,500,30); 149 insert into aff01 values (7566,'JONES','MANAGER',7839,'1981-04-02',2975,NULL,20); 150 insert into aff01 values (7654,'MARTIN','SALESMAN',7698,'1981-09-28',1250,1400,30); 151 insert into aff01 values (7698,'BLAKE','MANAGER',7839,'1981-05-01',2850,NULL,30); 152 insert into aff01 values (7782,'CLARK','MANAGER',7839,'1981-06-09',2450,NULL,10); 153 insert into aff01 values (7788,'SCOTT','ANALYST',7566,'0087-07-13',3000,NULL,20); 154 insert into aff01 values (7839,'KING','PRESIDENT',NULL,'1981-11-17',5000,NULL,10); 155 insert into aff01 values (7844,'TURNER','SALESMAN',7698,'1981-09-08',1500,0,30); 156 insert into aff01 values (7876,'ADAMS','CLERK',7788,'0087-07-13',1100,NULL,20); 157 insert into aff01 values (7900,'JAMES','CLERK',7698,'1981-12-03',950,NULL,30); 158 insert into aff01 values (7902,'FORD','ANALYST',7566,'1981-12-03',3000,NULL,20); 159 insert into aff01 values (7934,'MILLER','CLERK',7782,'1982-01-23',1300,NULL,10); 160 161 select count(*) from pri01; 162 select count(*) from aff01; 163 164 show create table pri01; 165 show create table aff01; 166 167 drop snapshot if exists sp04; 168 create snapshot sp04 for account acc01; 169 -- @ignore:1 170 show snapshots where snapshot_name = 'sp04'; 171 select count(*) from mo_catalog.mo_tables{snapshot = 'sp04'} where reldatabase = 'test03'; 172 -- @ignore:0,6,7 173 select * from mo_catalog.mo_database{snapshot = 'sp04'} where datname = 'test03'; 174 select attname from mo_catalog.mo_columns{snapshot = 'sp04'} where att_database = 'test03'; 175 176 select * from aff01{snapshot = 'sp04'}; 177 select * from pri01{snapshot = 'sp04'}; 178 179 drop database test03; 180 select * from test03.aff01{snapshot = 'sp04'}; 181 select * from test03.pri01{snapshot = 'sp04'}; 182 select count(*) from test03.aff01{snapshot = 'sp04'}; 183 184 restore account acc01 from snapshot sp04; 185 use test03; 186 show create table aff01; 187 show create table pri01; 188 select count(*) from aff01; 189 drop database test03; 190 drop snapshot sp04; 191 192 193 194 195 -- restore non-sys account to current account 196 drop database if exists test01; 197 create database test01; 198 use test01; 199 create table t1(col1 int, col2 decimal); 200 insert into t1 values(1,2); 201 insert into t1 values(2,3); 202 insert into t1 values(3,4); 203 create table t2(cool1 int primary key , col2 decimal); 204 insert into t2 select * from t1; 205 create table t3 like t2; 206 select count(*) from t1; 207 select count(*) from t2; 208 select count(*) from t3; 209 210 drop database if exists test02; 211 create database test02; 212 use test02; 213 create table t1(col1 int, col2 decimal); 214 insert into t1 values(1,2); 215 insert into t1 values(2,3); 216 insert into t1 values(3,4); 217 create table t2(col1 int primary key , col2 decimal); 218 insert into t2 select * from t1; 219 create table t3 like t2; 220 insert into t3 select * from t2; 221 select count(*) from t1; 222 select count(*) from t2; 223 select count(*) from t3; 224 225 drop database if exists test03; 226 create database test03; 227 use test03; 228 create table t1(col1 int, col2 decimal); 229 insert into t1 values(1,2); 230 insert into t1 values(2,3); 231 insert into t1 values(3,4); 232 create table t2(cool1 int primary key , col2 decimal); 233 insert into t2 select * from t1; 234 create table t3 like t2; 235 insert into t3 select * from t2; 236 insert into t3 select * from t2; 237 select count(*) from t1; 238 select count(*) from t2; 239 select count(*) from t3; 240 241 drop snapshot if exists snap01; 242 create snapshot snap01 for account acc01; 243 select count(*) from test01.t1 {snapshot = 'snap01'}; 244 select count(*) from test02.t2 {snapshot = 'snap01'}; 245 select count(*) from test03.t3 {snapshot = 'snap01'}; 246 247 drop database test01; 248 drop database test02; 249 show databases; 250 251 select * from test01.t1; 252 select count(*) from test03.t3; 253 254 restore account acc01 from snapshot snap01; 255 256 show databases; 257 select count(*) from test01.t1; 258 select * from test01.t1; 259 select count(*) from test02.t2; 260 select * from test02.t2; 261 select count(*) from test03.t3; 262 select * from test03.t3; 263 show create table test01.t1; 264 show create table test02.t2; 265 show create table test03.t2; 266 drop database test01; 267 drop database test02; 268 drop database test03; 269 drop snapshot snap01; 270 271 272 273 274 -- restore null 275 drop snapshot if exists sp05; 276 create snapshot sp05 for account acc01; 277 create database db01; 278 restore account acc01 FROM snapshot sp05; 279 show databases; 280 drop snapshot sp05; 281 282 283 284 285 -- acc01 create sp01,sp02, restore sp02, restore sp01 286 drop database if exists db01; 287 create database db01; 288 use db01; 289 drop table if exists table01; 290 create table table01(col1 int primary key , col2 decimal, col3 char, col4 varchar(20), col5 text, col6 double); 291 insert into table01 values (1, 2, 'a', '23eiojf', 'r23v324r23rer', 3923.324); 292 insert into table01 values (2, 3, 'b', '32r32r', 'database', 1111111); 293 drop table if exists table02; 294 create table table02 (col1 int unique key, col2 varchar(20)); 295 insert into table02 (col1, col2) values (133, 'database'); 296 297 drop snapshot if exists sp07; 298 create snapshot sp07 for account acc01; 299 300 drop table table01; 301 insert into table02 values(134, 'database'); 302 303 drop snapshot if exists sp08; 304 create snapshot sp08 for account acc01; 305 -- @ignore:1 306 show snapshots; 307 restore account acc01 from snapshot sp08; 308 select * from table02; 309 select * from db01.table01; 310 select count(*) from table02; 311 312 restore account acc01 from snapshot sp07; 313 select * from table01; 314 select * from table02; 315 select count(*) from table01; 316 select count(*) from table02; 317 318 drop snapshot sp07; 319 drop snapshot sp08; 320 drop database db01; 321 322 323 324 325 -- acc01 create sp01,sp02, restore sp01, restore sp02 326 drop database if exists db02; 327 create database db02; 328 use db02; 329 drop table if exists table01; 330 create table table01(col1 int primary key , col2 decimal, col3 char, col4 varchar(20), col5 text, col6 double); 331 insert into table01 values (1, 2, 'a', '23eiojf', 'r23v324r23rer', 3923.324); 332 insert into table01 values (2, 3, 'b', '32r32r', 'database', 1111111); 333 drop table if exists table02; 334 create table table02 (col1 int unique key, col2 varchar(20)); 335 insert into table02 (col1, col2) values (133, 'database'); 336 337 drop snapshot if exists sp09; 338 create snapshot sp09 for account acc01; 339 340 drop table table01; 341 insert into table02 values(134, 'database'); 342 343 drop snapshot if exists sp10; 344 create snapshot sp10 for account acc01; 345 -- @ignore:1 346 show snapshots; 347 restore account acc01 from snapshot sp09; 348 select * from table02; 349 select * from db02.table01; 350 select count(*) from table02; 351 select count(*) from table01; 352 353 restore account acc01 from snapshot sp10; 354 select * from db02.table01; 355 select count(*) from table01; 356 357 select * from db02.table02; 358 select count(*) from table02; 359 360 drop snapshot sp09; 361 drop snapshot sp10; 362 drop database db02; 363 364 365 366 367 -- restore frequently 368 drop database if exists db03; 369 create database db03; 370 use db03; 371 drop table if exists ti1; 372 drop table if exists tm1; 373 drop table if exists ti2; 374 drop table if exists tm2; 375 376 create table ti1(a INT not null, b INT, c INT); 377 create table tm1(a INT not null, b INT, c INT); 378 create table ti2(a INT primary key AUTO_INCREMENT, b INT, c INT); 379 create table tm2(a INT primary key AUTO_INCREMENT, b INT, c INT); 380 show create table ti1; 381 show create table tm1; 382 show create table ti2; 383 show create table tm2; 384 drop snapshot if exists sp11; 385 create snapshot sp11 for account acc01; 386 387 insert into ti1 values (1,1,1), (2,2,2); 388 insert into ti2 values (1,1,1), (2,2,2); 389 select * from ti1; 390 select * from tm1; 391 select * from ti2; 392 select * from tm2; 393 drop snapshot if exists sp12; 394 create snapshot sp12 for account acc01; 395 396 insert into tm1 values (1,1,1), (2,2,2); 397 insert into tm2 values (1,1,1), (2,2,2); 398 select * from ti1 {snapshot = 'sp12'}; 399 select * from tm1; 400 select * from ti2 {snapshot = 'sp12'}; 401 select * from tm2; 402 drop snapshot if exists sp13; 403 create snapshot sp13 for account acc01; 404 405 alter table ti1 add constraint fi1 foreign key (b) references ti2(a); 406 alter table tm1 add constraint fm1 foreign key (b) references tm2(a); 407 drop snapshot if exists sp14; 408 create snapshot sp14 for account acc01; 409 410 show create table ti1 {snapshot = 'sp14'}; 411 show create table tm1 {snapshot = 'sp13'}; 412 show create table ti1 {snapshot = 'sp14'}; 413 show create table tm1 {snapshot = 'sp13'}; 414 415 alter table ti1 drop foreign key fi1; 416 alter table tm1 drop foreign key fm1; 417 truncate ti1; 418 truncate tm1; 419 drop snapshot if exists sp15; 420 create snapshot sp15 for account acc01; 421 422 show create table ti1 {snapshot = 'sp14'}; 423 show create table tm1 {snapshot = 'sp15'}; 424 show create table ti1 {snapshot = 'sp14'}; 425 show create table tm1 {snapshot = 'sp15'}; 426 427 select count(*) from ti1; 428 select count(*) from tm1; 429 select count(*) from ti2; 430 select count(*) from tm2; 431 432 restore account acc01 from snapshot sp11; 433 show databases; 434 select * from db03.ti1; 435 select * from db03.tm1; 436 select * from db03.ti2; 437 select * from db03.tm2; 438 show create table db03.ti1; 439 show create table db03.tm1; 440 show create table db03.ti2; 441 show create table db03.tm2; 442 443 restore account acc01 from snapshot sp14; 444 show databases; 445 select * from db03.ti1; 446 select * from db03.tm1; 447 select * from db03.ti2; 448 select * from db03.tm2; 449 show create table db03.ti1; 450 show create table db03.tm1; 451 show create table db03.ti2; 452 show create table db03.tm2; 453 454 -- @ignore:1 455 show snapshots; 456 457 drop database db03; 458 drop snapshot sp15; 459 drop snapshot sp14; 460 drop snapshot sp13; 461 drop snapshot sp12; 462 drop snapshot sp11; 463 464 465 466 467 -- restore db to current non-sys account 468 drop database if exists db04; 469 create database db04; 470 use db04; 471 create table table01(col1 int primary key ); 472 insert into table01 values (1); 473 insert into table01 values (2); 474 drop database if exists db05; 475 create database db05; 476 use db05; 477 create table table01(col1 int primary key ); 478 insert into table01 values (1); 479 insert into table01 values (2); 480 insert into table01 values (3); 481 drop database if exists db06; 482 create database db06; 483 use db06; 484 create table table01(col1 int primary key ); 485 insert into table01 values (1); 486 insert into table01 values (2); 487 insert into table01 values (3); 488 insert into table01 values (4); 489 select * from db04.table01; 490 select * from db05.table01; 491 select * from db06.table01; 492 493 drop snapshot if exists sp13; 494 create snapshot sp13 for account acc01; 495 insert into db04.table01 values (200); 496 insert into db05.table01 values (400); 497 498 restore account acc01 database db04 from snapshot sp13; 499 500 show databases; 501 use db04; 502 select count(*) from db04.table01; 503 select * from db04.table01; 504 use db05; 505 select count(*) from db05.table01; 506 select * from db05.table01; 507 use db06; 508 select count(*) from db06.table01; 509 select * from db06.table01; 510 drop snapshot sp13; 511 drop database db04; 512 drop database db05; 513 drop database db06; 514 515 516 517 518 -- restore db to current non-sys account 519 drop database if exists db07; 520 create database db07; 521 use db07; 522 create table table01 (col1 int, col2 enum ('a','b','c')); 523 insert into table01 values(1,'a'); 524 insert into table01 values(2, 'b'); 525 create table table02 (col1 int unique key, col2 enum ('a','b','c')); 526 insert into table02 values(1,'a'); 527 insert into table02 values(2, 'b'); 528 insert into table02 values(3, 'b'); 529 drop database if exists db08; 530 create database db08; 531 use db08; 532 create table index01(col1 int,key key1(col1)); 533 insert into index01 values (1); 534 insert into index01 values (2); 535 show create table db07.table02; 536 537 drop snapshot if exists sp14; 538 create snapshot sp14 for account acc01; 539 use db07; 540 drop table table01; 541 alter table table02 add column newC int first; 542 show create table table02; 543 show create table table02 {snapshot = 'sp14'}; 544 drop database db08; 545 546 restore account acc01 database db07 from snapshot sp14; 547 restore account acc01 database db08 from snapshot sp14; 548 549 show databases; 550 use db07; 551 show tables; 552 show create table table01 {snapshot = 'sp14'}; 553 show create table table01; 554 select * from table01; 555 556 drop snapshot if exists sp15; 557 create snapshot sp15 for account acc01; 558 559 restore account acc01 database db07 from snapshot sp15; 560 restore account acc01 database db08 from snapshot sp15; 561 562 use db08; 563 show tables; 564 select * from index01; 565 show create table index01; 566 use db07; 567 show tables; 568 show create table table01 {snapshot = 'sp14'}; 569 show create table table01; 570 571 -- @ignore:1 572 show snapshots; 573 drop snapshot sp14; 574 drop snapshot sp15; 575 drop database db07; 576 577 578 579 580 -- abnormal test :restore non-exists db to current account 581 drop database if exists db08; 582 create database db08; 583 use db08; 584 create table db08 (col1 int); 585 insert into db08 values(1), (100), (20000); 586 drop snapshot if exists sp15; 587 create snapshot sp15 for account acc01; 588 insert into db08 (col1) values (3000); 589 590 restore account acc01 database db from snapshot sp15; 591 drop snapshot sp15; 592 drop database db08; 593 594 595 596 597 -- abnormal test: restore non-exists table to current account 598 drop database if exists db09; 599 create database db09; 600 use db09; 601 drop table if exists index01; 602 create table index01( 603 col1 int not null, 604 col2 date not null, 605 col3 varchar(16) not null, 606 col4 int unsigned not null, 607 primary key (col1) 608 ); 609 insert into index01 values(1, '1980-12-17','Abby', 21); 610 insert into index01 values(2, '1981-02-20','Bob', 22); 611 insert into index01 values(3, '1981-02-20','Bob', 22); 612 select count(*) from index01; 613 614 drop table if exists index02; 615 create table index02(col1 char, col2 int, col3 binary); 616 insert into index02 values('a', 33, 1); 617 insert into index02 values('c', 231, 0); 618 alter table index02 add key pk(col1) comment 'primary key'; 619 select count(*) from index02; 620 621 drop database if exists db10; 622 create database db10; 623 use db10; 624 drop table if exists index03; 625 create table index03 ( 626 emp_no int not null, 627 birth_date date not null, 628 first_name varchar(14) not null, 629 last_name varchar(16) not null, 630 gender varchar(5) not null, 631 hire_date date not null, 632 primary key (emp_no) 633 ) partition by range columns (emp_no)( 634 partition p01 values less than (100001), 635 partition p02 values less than (200001), 636 partition p03 values less than (300001), 637 partition p04 values less than (400001) 638 ); 639 640 insert into index03 values (9001,'1980-12-17', 'SMITH', 'CLERK', 'F', '2008-12-17'), 641 (9002,'1981-02-20', 'ALLEN', 'SALESMAN', 'F', '2008-02-20'); 642 643 drop snapshot if exists sp16; 644 create snapshot sp16 for account acc01; 645 646 use db09; 647 delete from index02 where col1 = 'a'; 648 select * from index02; 649 update index01 set col1 = 1000 where col1 = 1; 650 select * from index01; 651 652 use db10; 653 truncate index03; 654 select * from index03; 655 656 restore account acc01 database db09 table index01 from snapshot sp16; 657 restore account acc01 database db10 table index03 from snapshot sp16; 658 659 use db09; 660 select * from index02; 661 select * from index01; 662 show create table index01; 663 show create table index02; 664 use db10; 665 select * from index03; 666 667 -- @ignore:1 668 show snapshots; 669 drop database db09; 670 drop database db10; 671 drop snapshot sp16; 672 673 674 675 676 -- cross restore non-exists table to current account 677 drop database if exists db11; 678 create database db11; 679 use db11; 680 drop table if exists pri01; 681 create table pri01 (col1 int, col2 decimal); 682 insert into pri01 (col1, col2) values (1,2378.328839842); 683 insert into pri01 values (234, -3923.2342342); 684 select * from pri01; 685 686 drop snapshot if exists sp17; 687 create snapshot sp17 for account acc01; 688 689 alter table pri01 add constraint primary key(col1); 690 insert into pri01 values (23423, 32432543.3242); 691 insert into pri01 values (234222, -3923.2342342); 692 693 drop snapshot if exists sp18; 694 create snapshot sp18 for account acc01; 695 696 restore account acc01 database db11 table pri01 from snapshot sp18; 697 show create table pri01; 698 select * from pri01; 699 select count(*) from pri01; 700 701 restore account acc01 database db11 table pri01 from snapshot sp17; 702 show create table pri01; 703 select * from pri01; 704 select count(*) from pri01; 705 706 restore account acc01 database db11 table pri01 from snapshot sp18; 707 show create table pri01; 708 select * from pri01; 709 select count(*) from pri01; 710 insert into pri01 values(23420, 32432543.3242); 711 select * from pri01; 712 show columns from pri01; 713 select count(*) from mo_catalog.mo_tables{snapshot = 'sp18'} where reldatabase = 'db11'; 714 -- @ignore:0,6,7 715 select * from mo_catalog.mo_database{snapshot = 'sp18'} where datname = 'db11'; 716 select attname from mo_catalog.mo_columns{snapshot = 'sp18'} where att_database = 'db11'; 717 718 drop database db11; 719 drop snapshot sp18; 720 drop snapshot sp17; 721 722 723 724 725 -- empty tables restore to non-sys account 726 drop database if exists db12; 727 create database db12; 728 use db12; 729 create table table01 (col int); 730 create table table02 (col char); 731 create table table03 (col char); 732 create table table04 (col binary); 733 drop snapshot if exists sp19; 734 create snapshot sp19 for account acc01; 735 insert into table01 values (1); 736 insert into table02 values ('1'); 737 insert into table03 values ('3'); 738 insert into table04 values ('1'); 739 restore account acc01 database db12 table table01 from snapshot sp19; 740 restore account acc01 database db12 table table02 from snapshot sp19; 741 restore account acc01 database db12 table table03 from snapshot sp19; 742 restore account acc01 database db12 table table04 from snapshot sp19; 743 select * from table01; 744 select * from table02; 745 select * from table03; 746 select * from table04; 747 drop database db12; 748 drop snapshot sp19; 749 -- @session 750 751 drop account acc01; 752 753 754 755 756