To duplicate an environment using a schema export makes it possible to change the names of the schemas involved.
Perform the following steps to copy an environment, for example, by copying production back to test:
•Create a configuration file.
•Create the users and tablespaces with bubs_create.bat.
•Install the database of Invantive Vision till the instantiate objects if the target environment is used for the first time.
•Export the data to a file with the statements:
set NLS_LANG=AMERICAN_AMERICA.AL32UTF8
exp userid=pbubs/pbubs@orcl buffer=1000000 file=pbubs.dmp grants=no log=pbubs_exp.log consistent=yes
•In the first ten lines of the log file check that there has been no conversion of characters between character sets.
•Stop Microsoft IIS and Apache Tomcat for the target environment.
•Clear the target environment: delete all old tables, sequences, views, functions, procedures, triggers and packages.
•Upload the file in the new environment based upon an export made by the owner of the application:
set NLS_LANG=AMERICAN_AMERICA.AL32UTF8
imp userid=tbubs/tbubs@orcl buffer=1000000 file=pbubs.dmp log=imp_bubs.log full=y ignore=y
•Check that all objects are valid and check that the counts concerning numbers of objects between the environments are correct, for instance with the following query:
select owner
, count(*)
, object_type
, status
from dba_objects
where owner like '%BUBS'
group
by owner
, object_type
, status
/
•Copy the rights by executing the following script as being the Invantive Vision application owner (in this example pbubs). Do replace OLD and NEW by the right schema names:
set pages 0
set feedback off
set lines 500
set trimspool on
spool grt.sql
select replace
( replace
( 'grant '
|| privilege
|| ' on '
|| table_name
|| ' to '
|| grantee
|| ';'
, 'OUD'
, 'NIEUW'
)
, 'OUDITGEN'
, 'NIEUWITGEN'
)
txt
from user_tab_privs
where 1=1
and grantee <> 'OUD'
/
spool off
exit
•Then, log on as the new Invantive Vision application owner NEW under Oracle SQL*Plus and execute the script:
connect NIEUW@orcldb01
@grt
•Add the needed synonyms under Oracle SQL*Plus:
connect NIEUW_tomcat@DATABASEID
begin
<BUBS OWNER>.bubs_maintain_my_synonyms('<BUBS OWNER>');
end;
•Finally, copy the software from the Tomcat webapps tree to the target server:
cd /opt/tomcat/webapps
mv bubstarget /tmp/bubstarget
cp -pr bubssource bubstarget
•Do not forget to enter the correct passwords into site.properties and to adjust the URL's. See Site.properties.
•Restart Invantive Vision:
/etc/init.d/bubs3 restart
•Open the application as user ‘system’.
•Change in settings the description of the environment.
•Adapt the profile options.
•Change in the screen financial Administrations, the administration from where data is uploaded.
•If necessary, change the passwords of all users with an SQL update:
connect NIEUW_tomcat@DATABASEID
begin
bubs_session.set_session_info(null, null, 'system', null, null, null, null);
end;
/
update bubs_gebruikers_v
set gbr_wachtwoord='test'
where gbr_wachtwoord is not null
/
commit
/
•Delete all documents from the document folder of the target environment.
•Copy the documents in the document folder of the source environment to the target environment.
•Link the documents to the new directory:
update bubs_documenten_v
set dct_bestandsinhoud=bfilename('<NIEUW_DCT>', bubs_get_bfile_filename(dct_bestandsinhoud))
where bubs_get_bfile_directory(dct_bestandsinhoud) <> '<NIEUW>_DCT'
and dct_bestand_url is null
/
commit
/
•Update the license as user ‘system’.