求问各位大神如何重命名SCHEMA的名字
db2吧
全部回复
仅看楼主
level 1
求问各位大神如何重命名SCHEMA的名字 谢谢
2015年08月12日 09点08分 1
level 1
http://www-01.ibm.com/support/docview.wss?uid=swg21289066
Question
Have you ever wanted to change the schema name in DB2? Below you will find steps to do this using db2move and db2look:.
Answer
1) Issue "db2look -d <DBNAME> -e -o <outputfile.sql>"
2) In the outputfile.sql file, find and change the schema to your new schema name. You can use UNIX text editor Vi and edit the file by use the following command ":1,$s/<SEARCH>/<REPLACE>/g" to search and replace or use any text editor that you desire.
3) Issue "db2move <dbname> export". This will create several files, including a db2move.lst file, in your current directory.
4) You will also need to edit the generated db2move.lst file and change the schema names to the new desired name.
5) Drop existing user tables (this step is for renaming the schema within the same database)
6) Issue "db2 -tvf outputfile.sql" (this runs the output file generated by the db2look command to recreate the tables with the new schema name)
2015年08月12日 12点08分 2
1