Oracle - Backup and Restore
Before upgrading your Palantir instance, backing up your instance is recommended. Please follow the instructions below to backup and restore your palantir oracle schemas.
Preparing for backup and restore
The instructions below are 10g specific, they take advantage of the new impdp and expdp utilities. You can read more about them here Oracle Data Pump in Oracle Database 10g. Preparing the DB In order to export or import using the expdb and impdb utilities in Oracle 10g, you must first create an oracle directory object to point at your local file system. First, grant "create any directory" to the user, in this example, "palantir_user": [oracle]$ . oraenv ORACLE_SID = [oracle] ? <SID_name> [oracle oracle]$ sqlplus /nolog SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 17 13:43:08 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> connect sys/password as sysdba Connected. SQL> grant create any directory to palantir_user; Grant succeeded. SQL> grant EXP_FULL_DATABASE to palantir_user; Grant succeeded. SQL> grant IMP_FULL_DATABASE to palantir_user; Grant succeeded. SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64 bit Production With the Partitioning, OLAP and Data Mining options Next login as palantir_user and create the directory where you want the backup. The backup directory should already exist: [oracle]$ sqlplus palantir_user/password SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 17 13:43:40 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL> create or replace directory dmp_dir as '/u1/oracle'; Directory created. SQL> exit You can now use the dmp_dir directory object to expdp and impdp dmp files.
Oracle Backup (expdp)
You can use the oracle impdp/expdp utilities to backup a schema (aci_user) and restore it to another machine or even the same machine very easily. To do so you first must exp (export) the database:
[oracle]$ expdp palantir_user/password schemas=palantir_user directory=dmp_dir dumpfile=palantir_031707.dmp logfile=palantir_031707.log Export: Release 10.2.0.1.0 - 64bit Production on Saturday, 17 March, 2007 15:15:24 Copyright (c) 2003, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options Starting "PALANTIR_USER"."SYS_EXPORT_SCHEMA_01": palantir_user/**** schemas=palantir_user directory=dmp_dir dumpfile=palantir_031707.dmp logfile=palantir_031707.log Estimate in progress using BLOCKS method... Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA ... Total estimation using BLOCKS method: 14.20 GB ... . . exported "PALANTIR_USER"."PT_DATASOURCE_RECORD" 1.025 GB 10743004 rows . . exported "PALANTIR_USER"."PT_PROPERTY" 384.1 MB 2768318 rows ... This will use 4 workers to export your aci_user schema to the palantir_031707.dmp file in the dmp_dir you setup in the last step.
Oracle Restore (impdp)
To restore an oracle database from an exp dump, you must first drop all of the palantir objects from the schema. To do this, just drop the user and recreate it (see links below). After recreating the user, you'll need to follow the steps in 'Preparing the DB' above (i.e. since we just reset the user). For example: [oracle ~]$ sqlplus palantir_user/password as sysdba SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 9 11:51:18 2008 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL> drop user palantir_user CASCADE; User dropped. SQL> create user palantir_user identified by passsword; User created. SQL> grant resource, connect, create view to palantir_user; Grant succeeded. SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production With the Partitioning, OLAP and Data Mining options [oracle]$
Once the schema is cleared out, you need to imp the new dump: [oracle]$ impdp palantir_user/password schemas=palantir_user directory=dmp_dir dumpfile=palantir_031707.dmp logfile=imp_palantir_031707.log Import: Release 10.2.0.1.0 - 64bit Production on Saturday, 17 March, 2007 20:26:57 Copyright (c) 2003, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options Master table "PALANTIR_USER"."SYS_IMPORT_SCHEMA_01" successfully loaded/unloaded Starting "PALANTIR_USER"."SYS_IMPORT_SCHEMA_01": palantir_user/***** schemas=palantir_user directory=dmp_dir dumpfile=palantir_031707.dmp logfile=imp_palantir_031707.log* Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC ORA-31684: Object type TYPE:"PALANTIR_USER"."SGYTPCSEL" already exists Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE Processing object type SCHEMA_EXPORT/TABLE/TABLE ORA-39151: Table "PALANTIR_USER"."PLAN_TABLE" exists. All dependent metadata and data will be skipped due to table_exists_action of skip Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA . . imported "PALANTIR_USER"."PT_DATASOURCE" 7.261 GB 638809 rows . . imported "PALANTIR_USER"."PT_MEDIA" 1.688 GB 970442 rows . . imported "PALANTIR_USER"."PT_DATASOURCE_RECORD" 1.025 GB 10743004 rows . . imported "PALANTIR_USER"."PT_PROPERTY" 384.1 MB 2768318 rows ... Some dumps are done as one user and imported as another. If you are not importing as the same user, then you need to explicitly state this by adding the following parameter to your command line: REMAP_SCHEMA=palantir_user:new_user Thus the total command line would look as follows: [oracle]$ impdp palantir_user/password schemas=palantir_user directory=dmp_dir dumpfile=palantir_031707.dmp logfile=imp_palantir_031707.log REMAP_SCHEMA=palantir_user:new_user In addition, if you are switching tablespaces, you'll need to remap tablespaces: REMAP_TABLESPACE=support:users Lastly, always run dbms stats after an imp: [oracle]$ . oraenv ORACLE_SID = oracle ? oracle [oracle]$ sqlplus new_user/password SQL*Plus: Release 10.2.0.1.0 - Production on Sat Feb 17 17:05:17 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL> exec dbms_stats.gather_schema_stats('new_user');