The onunload and onload utilities
The onunload and onload utilities provide the fastest way to move data between computers that use the same database server on the same platform.
For example, your site purchases a more powerful UNIX computer to allow faster access for users. You need to transfer existing databases to the new database server on the new computer. Use onunload to unload data from the first database server and then use onload to load the data into the second database server. Both database servers must have the same version number, or they must have compatible version numbers. You can move an entire database or selected tables only, but you cannot modify the database schema.
The onunload utility can unload data more quickly than either dbexport or the UNLOAD statement because onunload copies the data in binary format and in page-sized units. The onload utility takes a tape or a file that the onunload utility creates and re-creates the database or the table. The onunload and onload utilities are faster than dbimport, dbload, or LOAD but are much less flexible and do not let you modify the database schema or move from one operating system or database server version to another.
You can use only onunload and onload if your answer to each of the following questions is yes. If your answer is no, you cannot use onunload and onload.
- Is the target database server on the same hardware platform?
- Do you want to move to another database server of the same version?
- Do you want to keep the existing database schema without modifying it?
- Do you want to move an entire database or an entire table?
- Are the page images compatible?
- Are the numeric representations the same?
When you can’t use the onunload and onload utilities
Because the data is written in page-sized units, you cannot use onunload and onload to move data between UNIX or Linux and Windows because they use different page sizes. For example, the page size is 2 KB on some UNIX systems and 4 KB on Windows.
Additionally, you cannot use onunload and onload:
- To move data between GLS and non-GLS databases.
- To move compressed data from one database to another.
- You must uncompress data in compressed tables and fragments before you use the onload and onunload utilities.
- To move external tables or databases that contain external tables.
- You must drop all the external tables before you use the onunload utility.
- To move tables and databases that contain extended or smart-large-object data types
How onunload command works
1) Before we start, we need to touch the tape file.
2) onunload command is:
onunload -t /data1/spaces_14/onunload_customer.unl -b 32 -s 2048 stores_demo:customer
Below file has been created
3) If your database is unbuffered on the target server. Please turn off the logging of your database on the target server
Command is: ontape –N Stores_demo:
You can run the below query to check if logging was turned off or not:
echo “select * from sysmaster:sysdatabases where name =’stores_demo'”| dbaccess stores_demo
4) How Onload command works:
onload -t /data1/gaurav/spaces_14/onunload_customer.unl -b 32 -s 2048 stores_demo:customer
Visit HCL OneDB for more information.
Start a Conversation with Us
We’re here to help you find the right solutions and support you in achieving your business goals.