์—ฌ๋Ÿฌ๊ฐ€์ง€ ์ด์œ ๋กœ ํ…Œ์ด๋ธ”์„ ์‚ญ์ œํ•  ์ƒํ™ฉ์ด ์žˆ๋‹ค.

Drop table๋กœ ํ•˜๋‚˜ํ•˜๋‚˜ ์ง€์šฐ๊ธฐ์— ๋„ˆ๋ฌด ์–‘์ด ๋งŽ์„๋•Œ ํ…Œ์ด๋ธ” ์ „์ฒด๋ฅผ ํ•œ๋ฒˆ์— ์‚ญ์ œํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ๋‹ค.

๊ทธ ๋ฐฉ๋ฒ•์„ ์•„๋ž˜์— ์†Œ๊ฐœํ•˜๊ฒ ๋‹ค.

 

๋จผ์ € sql์— ์ ‘์†ํ•œ ํ›„

 

SQL> Begin

2    for c in (select table_name from user_tables) loop

3    execute immediate ('drop table '||c.table_name||' cascade constraints');

4    end loop;

5    End;

6    . <- ์ฉœ ์ฐ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์—”ํ„ฐ

 

์ด๋ ‡๊ฒŒ ์ž…๋ ฅํ•˜๋ฉด

 

SQL>

 

๋‹ค์‹œ ์ด๋ ‡๊ฒŒ ์•„๋ฌด๊ฒƒ๋„ ์•ˆ๋œจ๋Š” ๋ช…๋ น์–ด๊ฐ€ ๋œฌ๋‹ค.

 

SQL> run

์„ ์‹คํ–‰ํ•œ๋‹ค.

์‹คํ–‰ํ•˜๋ฉด ์•„๋ž˜ ๊ตฌ๋ฌธ์ด ๋‚˜์˜ฌ๊ฒƒ์ด๋‹ค.

 

1    Begin

 

2    for c in (select table_name from user_tables) loop

3    execute immediate ('drop table '||c.table_name||' cascade constraints');

4    end loop;

5    End;

PL/SQL procedure successfully completed.<--๋ฉ”์‹œ์ง€๊ฐ€ ๋‚˜์˜ค๋ฉด ์„ฑ๊ณต

 

๊ทธ ํ›„์—

SQL> purge recyclebin; 

Recyclebin purged.<===ํœด์ง€ํ†ต์ด ๋น„์›Œ์กŒ๋‹ค๋Š” ๋ฌธ๊ตฌ๊ฐ€ ๋‚˜์˜จ๋‹ค.

 

๊ทธํ›„ select * from tab;์„ ํ•ด๋ณด๋ฉด ๊นจ๋—ํžˆ ์ง€์›Œ์ง„ ํ…Œ์ด๋ธ”์„ ๋ณผ ์ˆ˜ ์žˆ์„๊ฒƒ์ด๋‹ค.




์ถœ์ฒ˜ : http://munjee.tistory.com/16