CARIS HPD : Database Administration : Exporting and Importing HPD Schemas (Oracle) : Import a Previously Exported Database Schema : Recreate the Tablespace and HPD Schema Owner Account
 

Recreate the Tablespace and HPD Schema Owner Account

To import a database export into the new database, recreate the tablespace first, ensuring that it is large enough to hold the imported data. Recreate the HPD schema user account, which is done using a script provided with the HPD Server release.

Important

The name of the new tablespace and the name of the new user must be the same as the previously exported ones. (This is not required for the datafiles.)

Connect as the Oracle System user account to the new database and create the tablespace from a Command Prompt. Additional Information about creating tablespaces can be found on the Oracle Documentation for your specific Operating System.

> cd C:\ProgramData\CARIS\HPD\<version>\Server\NewDatabase

> sqlplus system/password@databasename

SQL> set serveroutput on size 200000

-- Create a new tablespace big enough to hold the data about to be imported,
   where the size is given in MB or GB, e.g. ‘size 400M’ or ‘size 36G’:

-- EXAMPLE 1: Tablespace >32GB (4194303 blocks) using only 1 datafile
-- UNIX example: use the BIGFILE Tablespace option for datafiles >32GB:

SQL> CREATE BIGFILE TABLESPACE tablespace_name DATAFILE '/u01/oracle/oradata/databasename/datafile_name_df1.dbf'
SIZE 32G AUTOEXTEND ON NEXT 64M MAXSIZE 64G LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

Tablespace created.

 

-- EXAMPLE 2: Tablespace <32GB (4194303 blocks) in size using 1 datafile
-- Windows example: use the SMALLFILE Tablespace option for datafiles <32GB:

SQL> CREATE SMALLFILE TABLESPACE tablespace_name DATAFILE 'D:\oracle\ oradata\database_name\datafile_name_df1.dbf'
SIZE 10G AUTOEXTEND ON NEXT 64M MAXSIZE 31G LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

Tablespace created.

 

-- EXAMPLE 3: Tablespace >32GB using two (or more) datafiles <32GB:

SQL> CREATE SMALLFILE TABLESPACE tablespace_name DATAFILE '/u01/oracle/oradata/databasename/datafile_name_df1.dbf'
SIZE 18G AUTOEXTEND ON NEXT 64M MAXSIZE 31G , '/u01/oracle/oradata/databasename/datafile_name_df2.dbf'
SIZE 18G AUTOEXTEND ON NEXT 64M MAXSIZE 31G LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

Tablespace created.

Then run the 'createdbauser' script.

-- Optional: This step is only needed if the export was not done using the System or equivalent DBA role user account, for example, using the HPD Data Pump procedure.

Create user with appropriate privileges using the HPD ‘createdbauser.sql’ script where the four required parameters are:
   1-HPD schema owner user account
   2-HPD schema owner user Password
   3-not currently used by this script, so just enter the user name again
   4-tablespace name}

SQL> @createdbauser hpdowner password hpdowner tablespace_name

...program output messages appear here...

...

User created.

...more ‘Grant’ program output messages appear here...

...

Connect as the newly created user to insert data into it.

SQL> exit