DB2 Database migration from Linux to Windows Steps
1. Get the ddl from linux system by using the following command.
This ddl contains the table structures and associated indexes and sequesenses for a perticular
Schema.
db2look -d <db_name> -z <schema_name> -e |tee <Filename>.ddl
2. Export the data from the Database for a perticular schema using the following command.
db2move <DB_NAME> export -sn <schema_Name>
-- This will generate one .lst file and multiple .ixf,.msg files
3. Transfer the files generated in the above step to the windows system.
4. create the Database,bufferpool,tablespaces and schema manually in the windows machine using the following commands.
1. create db <DB_NAME>;
2. CREATE BUFFERPOOL <BUFFER_POOL_NAME> IMMEDIATE
ALL DBPARTITIONNUMS SIZE AUTOMATIC
NUMBLOCKPAGES 0
PAGESIZE 8 K;
3. CREATE REGULAR TABLESPACE <TABLESPACE_NAME>
PAGESIZE 8 K
MANAGED BY AUTOMATIC STORAGE
AUTORESIZE YES
BUFFERPOOL <BUFFER_POOL_NAME>
OVERHEAD 7.5
TRANSFERRATE 0.06;
4. CREATE SCHEMA <SCHEMA_NAME> AUTHORIZATION "DB2INST2";
Make Sure the PAGESIZE of tablespace as same as associated bufferpool size.
5. Run the ddl to create the tables and associated sequences and indexes using the below command.
db2 -tsvf <file_name>.ddl( which is generated in 1st step)
6. import the data to the database using the below command.
db2move <DB_NAME> load
-- which looks the .lst file generated 2nd step and uses ixf files to load the data with out
checking any contraints.
7. Run the below command to set the integrity for all tables.
1. Generate the script to set the integrity for all tables in a schema
db2 -x "select 'set integrity for ' || rtrim(tabschema) || '.' || rtrim(tabname) || ' immediate
checked;' from syscat.tables where tabschema='<schema_name>'"|tee set_integrity.sql
2. Run the script generated
db2 -tvf set_integrity.sql
8. Run the below command to reorg all tables.
1. Generate the script to set the integrity for all tables in a schema
db2 -x "select 'reorg table ' || rtrim(tabschema) || '.' || rtrim(tabname) || ';' from syscat.tables
where tabschema='<schema_name>'"|tee reorg.sql
2. Run the script generated
db2 -tvf reorg.sql
9. Give the grants to the tables and sequences as per your requirements.
This ddl contains the table structures and associated indexes and sequesenses for a perticular
Schema.
db2look -d <db_name> -z <schema_name> -e |tee <Filename>.ddl
2. Export the data from the Database for a perticular schema using the following command.
db2move <DB_NAME> export -sn <schema_Name>
-- This will generate one .lst file and multiple .ixf,.msg files
3. Transfer the files generated in the above step to the windows system.
4. create the Database,bufferpool,tablespaces and schema manually in the windows machine using the following commands.
1. create db <DB_NAME>;
2. CREATE BUFFERPOOL <BUFFER_POOL_NAME> IMMEDIATE
ALL DBPARTITIONNUMS SIZE AUTOMATIC
NUMBLOCKPAGES 0
PAGESIZE 8 K;
3. CREATE REGULAR TABLESPACE <TABLESPACE_NAME>
PAGESIZE 8 K
MANAGED BY AUTOMATIC STORAGE
AUTORESIZE YES
BUFFERPOOL <BUFFER_POOL_NAME>
OVERHEAD 7.5
TRANSFERRATE 0.06;
4. CREATE SCHEMA <SCHEMA_NAME> AUTHORIZATION "DB2INST2";
Make Sure the PAGESIZE of tablespace as same as associated bufferpool size.
5. Run the ddl to create the tables and associated sequences and indexes using the below command.
db2 -tsvf <file_name>.ddl( which is generated in 1st step)
6. import the data to the database using the below command.
db2move <DB_NAME> load
-- which looks the .lst file generated 2nd step and uses ixf files to load the data with out
checking any contraints.
7. Run the below command to set the integrity for all tables.
1. Generate the script to set the integrity for all tables in a schema
db2 -x "select 'set integrity for ' || rtrim(tabschema) || '.' || rtrim(tabname) || ' immediate
checked;' from syscat.tables where tabschema='<schema_name>'"|tee set_integrity.sql
2. Run the script generated
db2 -tvf set_integrity.sql
8. Run the below command to reorg all tables.
1. Generate the script to set the integrity for all tables in a schema
db2 -x "select 'reorg table ' || rtrim(tabschema) || '.' || rtrim(tabname) || ';' from syscat.tables
where tabschema='<schema_name>'"|tee reorg.sql
2. Run the script generated
db2 -tvf reorg.sql
9. Give the grants to the tables and sequences as per your requirements.
Comments
Post a Comment