Questo contenuto non è disponibile nella lingua selezionata.
13.8.3. Migrating from an Embedded Database to an External Oracle Database
The requirements to migrate from Embedded to an External Oracle Database:
- A complete installation of Red Hat Satellite server with an Embedded Database (
satellite.example.com) - A system hosting a running instance of Oracle Database (
oracledb.example.com). See Section 4.3.1, “External Database Requirements” for configuration details.
Procedure 13.4. Migrating to an External Oracle Database
- Shut down all services on the Red Hat Satellite server, but start the Embedded Database with
db-control:rhn-satellite stop db-control start
[root@satellite ~]# rhn-satellite stop [root@satellite ~]# db-control startCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Remove the
rhn-upgradeif it exists on your server:yum remove rhn-upgrade
[root@satellite ~]# yum remove rhn-upgradeCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Update your database to the latest schema version:
yum update satellite-schema spacewalk-schema-upgrade
[root@satellite ~]# yum update satellite-schema [root@satellite ~]# spacewalk-schema-upgradeCopy to Clipboard Copied! Toggle word wrap Toggle overflow This ensures that your database version matches the latest version on the External Oracle Database. - Create a directory to hold your database snapshot.
mkdir ~/dbbackup cd ~/dbbackup
[root@satellite ~]# mkdir ~/dbbackup [root@satellite ~]# cd ~/dbbackupCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Export the database using
spacewalk-dump-schema:spacewalk-dump-schema --to=oracle > migrate-to-oracle.sql
[root@satellite dbbackup]# spacewalk-dump-schema --to=oracle > migrate-to-oracle.sqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Stop the Embedded Database:
db-control stop
[root@satellite dbbackup]# db-control stopCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Exchange the PostgreSQL drivers and configuration scripts with the Oracle drivers and configuration scripts on the Satellite server:
yum remove -y spacewalk-postgresql yum install -y spacewalk-oracle yum remove -y spacewalk-java-postgresql spacewalk-backend-sql-postgresql
[root@satellite dbbackup]# yum remove -y spacewalk-postgresql [root@satellite dbbackup]# yum install -y spacewalk-oracle [root@satellite dbbackup]# yum remove -y spacewalk-java-postgresql spacewalk-backend-sql-postgresqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Use
spacewalk-setupto populate the External Oracle Database:spacewalk-setup --db-only --external-oracle
[root@satellite dbbackup]# spacewalk-setup --db-only --external-oracleCopy to Clipboard Copied! Toggle word wrap Toggle overflow The script asks for your database details so Satellite can connect and populate the database. Enter your External Oracle Database details:** Database: Setting up database connection for Oracle backend. Database service name (SID)? oracledb Database hostname [localhost]? oracledb.example.com Database (listener) port [1521]?
** Database: Setting up database connection for Oracle backend. Database service name (SID)? oracledb Database hostname [localhost]? oracledb.example.com Database (listener) port [1521]?Copy to Clipboard Copied! Toggle word wrap Toggle overflow The script populates the database.Important
Use the default Oracle Database port (1521) for the Red Hat Satellite database. Using an alternative port can cause SELinux errors. - When the script completes database population, restore the database schema
spacewalk-sql -i < migrate-to-oracle.sql
[root@satellite dbbackup]# spacewalk-sql -i < migrate-to-oracle.sqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Important
You might need to change SELinux context of the migration script before loading it into Oracle Database:semanage fcontext -a -t oracle_sqlplus_exec_t /root/dbbackup/migrate-to-oracle.sql restorecon -v /root/dbbackup/migrate-to-oracle.sql
[root@satellite dbbackup]# semanage fcontext -a -t oracle_sqlplus_exec_t /root/dbbackup/migrate-to-oracle.sql [root@satellite dbbackup]# restorecon -v /root/dbbackup/migrate-to-oracle.sqlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Similarly, you might need to change SELinux context of dumped tables:semanage fcontext -a -t oracle_tmp_t "/tmp/dumped-tables(/.*)?" restorecon -R -v /tmp/dumped-tables/
[root@satellite dbbackup]# semanage fcontext -a -t oracle_tmp_t "/tmp/dumped-tables(/.*)?" [root@satellite dbbackup]# restorecon -R -v /tmp/dumped-tables/Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Remove the
postgresql92-serverandspacewalk-dobbypackages from the Satellite server.yum remove postgresql92-server spacewalk-dobby
[root@satellite ~]# yum remove postgresql92-server spacewalk-dobbyCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Start Red Hat Satellite.
rhn-satellite start
[root@satellite ~]# rhn-satellite startCopy to Clipboard Copied! Toggle word wrap Toggle overflow
The database is now migrated from an Embedded Database to an External Oracle Database.