ํน์ ํ
์ด๋ธ์ ์ ์ฝ์ฌํญ( not null, fk ๊ณผ ๊ฐ์ )์ ์ด๋ฆ, ํ
์ด๋ธ๋ช
, ์์ ์์ ๋ชฉ๋ก์ ๋ณด์ฌ์ค๋๋ค.
Below query command queries constraints'(not null, fk) name , owner, table name, column name, and position of the column.
SQL > select * from user_cons_columns where table_name='table_name';
[์ค๋ผํด/oracle11g] dump ํจ์ (0) | 2015.04.20 |
---|---|
[์ค๋ผํด/oracle11g] ์ธ์ฝ๋ฉ ๋ฌธ์ (0) | 2015.04.20 |
Rename์ ์ด์ฉํ ํ ์ด๋ธ ๋ฐฑ์ ( Table Backup using Renaming ) (0) | 2015.04.14 |
ํ ์ด๋ธ ๋ช ๋ณ๊ฒฝํ๊ธฐ ( Renaming Table Name ) (0) | 2015.04.14 |
์ธ๋ฑ์ค ๋ชฉ๋ก ์กฐํ ( Querying Index List ) (0) | 2015.04.14 |
ํ ์ด๋ธ ๋ฐฑ์ ์ ํ ๋์ export / import ๋ฅผ ์ด์ฉํ ์๋ ์์ง๋ง ๋จ์ํ๊ฒ rename ๋ช ๋ น์ด๋ฅผ ์ด์ฉํ ์๋ ์์ต๋๋ค. ๋ํ create ~ as select ~ ๋ฅผ ์ด์ฉํ ์๋ ์์ต๋๋ค.
ํ์ง๋ง ์ค๋์ ํ
์ด๋ธ ๋ช
์ ๋ณ๊ฒฝํ๊ณ ์๋ก ํ
์ด๋ธ์ ์์ฑํจ์ผ๋ก์จ ๋ฐฑ์
์ ํ ์ ์๋ ๋ฐฉ๋ฒ์ ์๊ฐํ๋๋ก ํ๊ฒ ์ต๋๋ค. ์ฐธ๊ณ ๋ก ์ด ๋ฐฉ๋ฒ์ blob๋ฐ์ดํ๊ฐ ๋ง์ ๊ฒฝ์ฐ์ ์๋นํ ์ ์ฉํฉ๋๋ค.
Step by Step
1) Query table name and index names linked to the table you want to backup
2) Rename table name
3) Rename indexes' name ( if specified explicitly when it is created )
4) Rename constraints' name ( if specified explicitly when it is created )
4) Use the same DDL used to create the renamed table
โป This way is very simple and fast then using "create table ~ as select * from ~" statement when the table has a huge blob data.
1) ๋ณ๊ฒฝํ๊ณ ์ํ๋ ํ ์ด๋ธ์ ์ด๋ค ์ธ๋ฑ์ค๋ค์ด ์๋์ง ์กฐํํฉ๋๋ค.
SQL > select index_name, table_name from user_indexes;
2) ํ
์ด๋ธ๋ช
์ ๋ณ๊ฒฝํฉ๋๋ค.
SQL > rename old_table to new_table;
3) ์ธ๋ฑ์ค๋ช
์ ๋ณ๊ฒฝํฉ๋๋ค. ( ์ธ๋ฑ์ค๋ช
์ด ์๋์์ฑ๋ ๊ฒ์ด ์๋ ๊ฒฝ์ฐ์๋ง )
SQL > alter index pk_old_table rename to pk_new_table;
4) ์ ์ฝ์ฌํญ๋ช
์ ๋ณ๊ฒฝํฉ๋๋ค. ( ์ ์ฝ์ฌํญ๋ช
์ด ์๋์์ฑ๋ ๊ฒ์ด ์๋ ๊ฒฝ์ฐ์๋ง )
SQL > select * from user_cons_columns where table_name='{table_name};
SQL > alter table {table name} rename constraint {constraint name} to {new constraint name}
5) ๊ธฐ์กด ํ ์ด๋ธ์ ์์ฑํ๋ DDL์ ์ฌ์ฉํ์ฌ ํ ์ด๋ธ์ ์๋ก ์์ฑํฉ๋๋ค.
SQL > create table .........
[์ค๋ผํด/oracle11g] dump ํจ์ (0) | 2015.04.20 |
---|---|
[์ค๋ผํด/oracle11g] ์ธ์ฝ๋ฉ ๋ฌธ์ (0) | 2015.04.20 |
ํ ์ด๋ธ ์ ์ฝ์ฌํญ ์กฐํํ๊ธฐ ( Querying constraints of a table ) (0) | 2015.04.14 |
ํ ์ด๋ธ ๋ช ๋ณ๊ฒฝํ๊ธฐ ( Renaming Table Name ) (0) | 2015.04.14 |
์ธ๋ฑ์ค ๋ชฉ๋ก ์กฐํ ( Querying Index List ) (0) | 2015.04.14 |
์ค๋์ ํ ์ด๋ธ ๋ช ๋ณ๊ฒฝํ๋ ๋ฒ์ ๋ํด์ ์์๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค.
ํ ์ด๋ธ ๋ช ์ ๋ณ๊ฒฝํ ๋๋ ์๋์ฒ๋ผ rename ๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํฉ๋๋ค.
Use rename command to rename a table to a new one.
SQL > rename {old table name} to {new table name}
Table renamed.
๋ณ๊ฒฝ์ด ์๋ฃ๋์๋์ง ์๋์ฟผ๋ฆฌ๋ฅผ ์ด์ฉํด์ ํ์ธํด๋ณด์ธ์.
Check if renaming was successful using below query. Below statement queries the table names owned by you.
SQL > select table_name from user_tables;
You would see renamed table name if it was successful.
[์ค๋ผํด/oracle11g] dump ํจ์ (0) | 2015.04.20 |
---|---|
[์ค๋ผํด/oracle11g] ์ธ์ฝ๋ฉ ๋ฌธ์ (0) | 2015.04.20 |
ํ ์ด๋ธ ์ ์ฝ์ฌํญ ์กฐํํ๊ธฐ ( Querying constraints of a table ) (0) | 2015.04.14 |
Rename์ ์ด์ฉํ ํ ์ด๋ธ ๋ฐฑ์ ( Table Backup using Renaming ) (0) | 2015.04.14 |
์ธ๋ฑ์ค ๋ชฉ๋ก ์กฐํ ( Querying Index List ) (0) | 2015.04.14 |
์ผ๋ฐ์ ์ ๋ก ๋ด๊ฐ ๊ฐ์ง๊ณ ์๋ ์ธ๋ฑ์ค ๋ชฉ๋ก์ ์กฐํํ๋ ค๋ฉด ์๋ ์ฟผ๋ฆฌ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
Querying index list owned by me.
SQL > select * from user_indexes;
Better to use below query to know which index is from which table because there are so many information on the user_indexes table.
์ ์ฟผ๋ฆฌ๋ฅผ ์คํํ๋ฉด ์๋นํ ๋ง์ ์์ ์ ๋ณด๊ฐ ๋์ค๊ฒ ๋ฉ๋๋ค. ์ด๋ ํ
์ด๋ธ์ ์ด๋ ์ธ๋ฑ์ค๊ฐ ์๋์ง๊ฐ ๊ถ๊ธํ๋ค๋ฉด ์๋ ์ฟผ๋ฆฌ๋ฅผ ์ด์ฉํ์๋ฉด ๋ฉ๋๋ค.
SQL > select index_name, table_name from user_indexes;
[์ค๋ผํด/oracle11g] dump ํจ์ (0) | 2015.04.20 |
---|---|
[์ค๋ผํด/oracle11g] ์ธ์ฝ๋ฉ ๋ฌธ์ (0) | 2015.04.20 |
ํ ์ด๋ธ ์ ์ฝ์ฌํญ ์กฐํํ๊ธฐ ( Querying constraints of a table ) (0) | 2015.04.14 |
Rename์ ์ด์ฉํ ํ ์ด๋ธ ๋ฐฑ์ ( Table Backup using Renaming ) (0) | 2015.04.14 |
ํ ์ด๋ธ ๋ช ๋ณ๊ฒฝํ๊ธฐ ( Renaming Table Name ) (0) | 2015.04.14 |