Dbms_job.interval ORA-23421
Hi ,
i have a job that its owner is user A
and i have a procedure X in user B that calls dbms_job.interval
user A calls procedure X but i am getting the error ORA-23421 !!!??
note : i can see user A jobs in all_jobs from X procedure .
the owner of the job who is calling X which i turn calls the dbms_job.interval
why i am getting this error
The procedure is defaulting as authid definer and thus is
executing "as user B". User B doesn't see User A's job.
You'd have to modify the procedure to be authid current_user OR
create the procedure in user A's schema. I would prefer the latter unless you
really use User B as the owner for ALL PLSQL code.
Similar Messages
-
ORA-23421 when calling dbms_defer_sys.schedule_purge
Hi all,
did anyone experience ORA-23421 when calling dbms_defer_sys.schedule_purge?
for settimg up an updatable materialized view replication between two Oracle 9.2 databases, I followed the steps detailed in "Oracle9i Replication Management API Reference" and when calling
DBMS_DEFER_SYS.SCHEDULE_PURGE (
next_date => SYSDATE,
interval => 'SYSDATE + 1/24',
delay_seconds => 0,
rollback_segment => '');
on the materialized view site, I get the error ORA-23421, telling me, that job number 48 is not a job in the job queue.
Do you have any idea, what's going wrong?
Thanks for your assistance
Siegfried HartungThe answer could be found at http://www.orafaq.com/forum/t/66106/0/
From a previous run of the initialization scripts another user owned the job, that was adressed. The issue was resolved by changing the script in order to use the old userid (snapadmin instead of mvadmin). -
DBMS_JOBS interval problems
Hi all,
We have 2 jobs running since a year, in the version ORACLE 8i, 8.1.7.0, recently i have applied patch and upgraded to 8.1.7.4. i dont know when this problem started after 20 days after my upgradation i found my job is not running properly, here is the result from user_jobs.
LAST_DATE LAST_SEC NEXT_DATE NEXT_SEC TOTAL_TIME B INTERVAL
19-NOV-04 09:03:07 20-NOV-04 17:30:33 410 N trunc(sysdate+1)+9/24 .
last datetime is 19th around 9AM, next date why it is showing 20th 17.30 PM, my interval is trunc(sysdate+1)+9/24 . is there any possibility we can see what problems occured while running job?
2nd job also problem
LAST_DATE LAST_SEC NEXT_DATE NEXT_SEC TOTAL_TIME B INTERVAL
20-NOV-04 00:15:16 21-NOV-04 23:45:00 308 N trunc(sysdate+1)+23.75/24 .
while i wanted job everyday to be run at 23.45 PM.
Please where the problm? is ther e any LOG to see?
Thanks in advanceWhat do the broken and failures columns of user_jobs say? Could it be that the job has failed and the next_date and next_sec are showing the next automatic re-try?
-
Help with Interval for DBMS_JOB
Hi,
I'd like to create a job using DBMS_JOB and schedule it to run once every month on the first Saturday of the month at 10 in the morning. How would i write the interval for this?
Thanks.user629987 wrote:
I have created the job in TOAD (the easy way) and now I am trying to reset the interval using the following statement....
exec dbms_job.interval(81460, next_day(last_day(trunc(sysdate)),'SAT'));
...so that it executes on the first saturday of every month ( i haven't figured out how to include the time component yet so that it will execute at 10am), The expression you gave always returns midnight on Saturday. 10 AM on Saturday is 10/24 of a day after that, so add (10/24).
but the statement gives me the following error:
>
ORA-23319: parameter value "03-MAR-12" is not appropriate
Any ideas how to fix this? Thanks.The 2nd argument of interval is supposed to be a string, such as 'SYSDATE + 7', taht can be evaluated dynamically. You're passing a DATE. Try:
exec dbms_job.interval (81460, 'next_day (last_day (trunc(sysdate)), ''SAT'') + (10/24)');Edited by: Frank Kulash on Feb 14, 2012 7:59 AM
Repeated the single-quotes around SAT, since that's inside a string literal. -
Calleing dbms_job from a package owned by someone else.
I have a package, called database_job, which acts as a api to dbms_job. I have created a public synonym and granted execute to public.
Problem is whan I call this procedure from a user trying to alter one of there jobs I get the error ora-23421: Job x is noy in the job queue.
Basicaly database_job is owned by app_user and the user who owned the job is bob. My quess is that dbms_job is being run as app_user, not bob, even though the user calling database_job is bob.
does this make sence and has anybody got a way round this problem.
Regards,
BenIs your database_job package defined as an invoker's rights package? Or as a definer's rights package? The default is definer's rights, but if you specify AUTHID CURRENT_USER you'll get invoker's rights. If (and only if) the invoker has privileges to do something will the procedure be able to do it.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Dbms_job - prevent automatic re-run of a one-time background job.
We have a job which dynamically spawns 5 background processes, each take roughly 2 hours to run (2 hours total, 10 hours if ran synchronous).
sys.dbms_job.submit(job => vJob2,
what => 'myProc;' );
COMMIT;
Sometimes in development there is such a huge load that some of the 5 background processes will receive a snapshot too old error. DBMS_JOB automatically re-starts the same job (vJob2) 16 times, but I don't want it to. I try to manually set the job to "broken" but the job number can no longer be seen (even though it is in the job queue) I get the error:
ORA-23421 Job number X is not a job in the job queue
First question, is there an init param that I can lower the value "16" to some lower number?
Second question, once I'm caught in this situation where I know the current job running is going to fail, how do I prevent it from automatically restarting yet again?
What I have tried:
Alter the job queue to 0, kill the sessions (whew! Nothing is running now, good!).
then try to set broken to "TRUE", but I get the annoying ORA-23421 because, well I don't know why. So when I put the job queue back to 4, off they start again.
Tried dropping the jobs, get same ORA-23421 message even though I can select those job numbers in a query and I can see them in my IDE interface.
Also, I am running as the user who submitted the jobs, so there is no permission issue here (e.g. submitted as user A, trying to set to broken or drop the job as person B).
Our Oracle RDBMS is 9.2.0.6 AIX.
Message was edited by:
johnsokI found this on asktom, which will prevent a DBMS_JOB proc/func/package from automatically re-starting. The basic premise is that whatever you are executing in the "what" command must not be led to think an error occurred even if it did.
Luckily in the following example, we already handled exceptions in the "myProc" code to capture errors in a log table, so this approach will work for us:
sys.dbms_job.submit(job => vJob2,
what => 'begin myProc; exception when others then null; end;' );
COMMIT;
I would still love to be able control the arbitrary number "16" though. Oh well.
--Kate -
Using DBMS_JOB to schedule auto execution of procedure on a daily basis
I need to implement a batch procedure for my project and would be using
DBMS_JOB for the same purpose.I have tried creating a job for the same
that I submitted using DBMS_JOB.SUBMIT() and I ran the job initially using
DBMS_JOB.run(). Now at this instant the next_time parameter to run the proc
is calculated automaticlly. How does the proc run automatically after that
in specified interval of time?? Do I need to access some dba_XX views for the
same.....or set some database parameters??You will need to set the "interval" portion of the job. Either with dbms_job.submit, or dbms_job.interval.
Lets say you wanted to run the job every morning at 4:30am, it would be:
trunc(sysdate)+1+4/24+30/1440
The "+1" increases it one day.
The "+4/24" increases it 4 hours.
The "+30/1440" increases it 30 minutes.
Hope this helps.
Brian -
To submit a job in dbms_job package with specific durations
Hi,
Want to set a job to run everyday from 8.00 am to 6.00 pm for every 30 min after that every hour.I want to set this in dbms_job package.The database is 10.2.0.3
The implementation notation used is
variable jobno number;
exec dbms_job.submit(:jobno,'begin procedurename; end;',sysdate,
'case when sysdate-trunc(sysdate)>=8/24 and sysdate-trunc(sysdate)<18/24 then sysdate+30/1440 else sysdate+1/24');
but the error resulted is parameter value not appropriate.Hi,
Obviously because you have two different interval strings 'sysdate+30/1440' and 'sysdate+1/24'.
(The interval strings are inaccurate, but that's a different story)
The preferred solution in 10g would be to use dbms_scheduler.
A workaround using dbms_job would be to use 2 ancilliary jobs to change the interval of your main job twice a day, calling dbms_job.interval.
Your interval strings will cause the time to drift.
You need to use trunc(sysdate,'HH24') instead of just sysdate.
Hth
Sybrand Bakker
Senior Oracle DBA -
How to get All Users from OID LDAP
Hi all,
I have Oracle Internet Directory(OID) and have created the users in it manually.
Now I want to extract all the users from OID. How can I get Users from OID??
Any response will be appritiated. If some one could show me demo code for that I shall be greatful to you.
Thanks and reagards
Pravyhi,
the notes from metalink:
bgards
elvis
Doc ID: Note:276688.1
Subject: How to copy (export/import) the Portal database schemas of IAS 9.0.4 to another database
Type: BULLETIN
Status: PUBLISHED
Content Type: TEXT/X-HTML
Creation Date: 18-JUN-2004
Last Revision Date: 05-AUG-2005
How to copy (export/import) Portal database schemas of IAS 9.0.4 to another database
Note 276688.1
Download scripts Unix: Attachment 276688.1:1
Download Perl scripts (Unix/NT) :Attachment 276688.1:2
This article is being delivered in Draft form and may contain errors. Please use the MetaLink "Feedback" button to advise Oracle of any issues related to this article.
HISTORY
Version 1.0 : 24-JUN-2004: creation
Version 1.1 : 25-JUN-2004: added a link to download the scripts from Metalink
Version 1.2 : 29-JUN-2004: Import script: Intermedia indexes are recreated. Imported jobs are reassigned to Portal. ptlconfig replaces ptlasst.
Version 1.3 : 09-JUL-2004: Additional updates. Usage of iasconfig.xml. Need only 3 environment variables to import.
Version 1.4 : 18-AUG-2004: Remark about 9.2.0.5 and 10.1.0.2 database
Version 1.5 : 26-AUG-2004: Duplicate job id
Version 1.6 : 29-NOV-2004: Remark about WWC-44131 and WWSBR_DOC_CTX_54
Version 1.7 : 07-JAN-2005: Attached perl scripts (for NT/Unix) at the end of the note
Version 1.8 : 12-MAY-2005: added a work-around for the WWSTO_SESS_FK1 issue
Version 1.9 : 07-JUL-2005: logoff trigger and 9.0.1 database export, import in 10g database
Version 1.10: 05-AUG-2005: reference to the 10.1.2 note
PURPOSE
This document explains how to copy a Portal database schema from a database to another database.
It allows restoring the Portal repository and the OID security associated with Portal.
It can be used to go in production by copying physically a database from a development portal to a production environment and avoid to use the export/import utilities of Portal.
This note:
uses the export/import on the database level
allows the export/import to be done between different platforms
The script are Unix based and for the BASH shell. They can be adapted for other platforms.
For the persons familiar with this technics in Portal 9.0.2, there is a list of the main differences with Portal 9.0.2 at the end of the note.
These scripts are based on the experience of a lot of persons in Portal 902.
The scripts are attached to the note. Download them here: Attachment 276688.1:1 : exp_schema_904.zip
A new version of the script was written in Perl. You can also download them, here: Attachment 276688.1:2 : exp_schema_904_v2.zip. They do exactly the same than the bash ones. But they have the advantage of working on all platforms.
SCOPE & APPLICATION
This document is intented for Portal administrators. For using this note, you need basic DBA skills.
This notes is for Portal 9.0.4.x only. The notes for Portal 9.0.2 are :
Note 228516.1 : How to copy (export/import) Portal database schemas of IAS 9.0.2 to another database
Note 217187.1 : How to restore a cold backup of a Portal IAS 9.0.2 on another machine
The note for Portal 10.1.2 is:
Note 330391.1 : How to copy (export/import) Portal database schemas of IAS 10.1.2 to another databaseMethod
The method that we will follow in the document is the following one:
Export:
- export of the 4 portal schemas of a database (DEV / development)
- export the LDAP OID users and groups (optional)
Install a new machine with fresh IAS installation (PROD / production)
Import:
- delete the new and empty portal schema on PROD
- import the schemas in the production database in place of the deleted schemas
- import the LDAP OID users and groups (optional)
- modify the configuration such that the infrastructure uses the portal repository of the backup
- modify the configuration such that the portal repository uses the OID, webcache and SSO of the new infrastructure
The export and the import are divided in several steps. All of these steps are included in 2 sample scripts:
export : exp_portal_schema.sh
import : imp_portal_schema.sh
In the 2 scripts, all the steps are runned in one shot. It is just an example. Depending of the configuration and circonstance, all the steps can be runned independently.
Convention
Development (DEV) is the name of the machine where resides the copied database
Production (PROD) is the name of the machine where the database is copied
Prerequisite
Some prerequisite first.
A. Environment variables
To run the import/export, you will need 3 environment variables. In the given scripts, they are defined in 'portal_env.sh'
SYS_PASSWORD - the password of user sys in the Portal database
IAS_PASSWORD - the password of IAS
ORACLE_HOME - the ORACLE_HOME of the midtier
The rest of the settings are found automatically by reading the iasconfig.xml file and querying the OID. It is done in 'portal_automatic_env.sh'. I wish to write a note on iasconfig.xml and the way to transform it in usefull environment variables. But it is not done yet. In the meanwhile, you can read the old 902 doc, that explains the meaning of most variables :
< Note 223438.1 : Shell script to find your portal passwords, settings and place them in environment variables on Unix >
B. Definition: Cutter database
A 'Cutter Database' is the term used to designate a Database created by RepCA or OUI and that contains all the schemas used by a IAS 9.0.4 infrastructure. Even if in most cases, several schemas are not used.
In Portal 9.0.4, the option to install only the portal repository in an empty database has been removed. It has been replaced by RepCA, a tool that creates an infrastructure database. Inside all the infrastucture database schemas, there are the portal schemas.
This does not stop people to use 2 databases for running portal. One for OID and one for Portal. But in comparison with Portal 9.0.2, all schemas exist in both databases even if some are not used.
The main idea of Cutter database is to have only 1 database type. And in the future, simplify the upgrades of customer installation
For an installation where Portal and OID/SSO are in 2 separate databases, it looks like this
Portal 9.0.2 Portal 9.0.4
Infrastructure database
(INFRA_SID)
The infrastructure contains:
- OID (used)
- OEM (used)
- Single Sign-on / orasso (used)
- Portal (not used)
The infrastructure contains:
- OID (used)
- OEM (used)
- Single Sign-on / orasso (used)
- Portal (not used)
Portal database
(PORTAL_SID)
The custom Portal database contains:
- Portal (used)
The custom Portal database (is also an infrastructure):
- OID (not used)
- OEM (not used)
- Single Sign-on / orasso (not used)
- Portal (used)
Whatever, the note will suppose there is only one single database. But it works also for 2 databases installation like the one explained above.
C. Directory structure.
The sample scripts given inside this note will be explained in the next paragraphs. But first, the scripts are done to use a directory structure that helps to classify the files.
Here is a list of important files used during the process of export/import:
File Name
Description
exp_portal_schema.sh
Sample script that exports all the data needed from a development machine
imp_portal_schema.sh
Sample script that import all the data into a production machine
portal_env.sh
Script that defines the env variable specific to your system (to configure)
portal_automatic_env.sh
Helper script to get all the rest of the Portal settings automatically
xsl
Directory containing all the XSL files (helper scripts)
del_authpassword.xsl
Helper script to remove the authpassword tags in the DSML files
portal_env_unix.sql
Helper script to get Portal settings from the iasconfig.xml file
exp_data
Directory containing all the exported data
portal_exp.dmp
export on the database level of the portal, portal_app, ... database schemas
iasconfig.xml
copy the name of iasconfig.xml of the midtier of DEV. Used to get the hostname and port of Webcache
portal_users.xml
export from LDAP of the OID users used by Portal (optional)
portal_groups.xml export from LDAP of the OID groups used by Portal (optional)
imp_log
Directory containing several spool and logs files generated during the import
import.log Log file generated when running the imp command
ptlconfig.log
Log generated by ptlconfig when rewiring portal to the infrastructure.
Some other spool files.
D. Known limitations
The scripts given in this note have the following known limitations:
It does not copy the data stored in the SSO schema: external applications definitions and the passwords stored for them.
See in the post steps: SSO migration to know how to do.
The ssomig command resides in the Infrastructure Oracle home. And all commands of Portal in the Midtier home. And practically, these 2 Oracle homes are most of the time not on the same machine. This is the reason.
The export of the users in OID exports from the default user location:
ldapsearch .... -b "cn=users,dc=domain,dc=com"
This is not 100% correct. The users are by default stored in something like "cn=users,dc=domain,dc=com". So, if the users are stored in the default location, it works. But if this location (user install base) is customized, it does not work.
The reason is that such settings means that the LDAP most of the time highly customized. And I prefer that the administrator to copy the real LDAP himself. The right command will probably depend of the customer case. So, I prefered not to take the risk..
orclCommonNicknameAttribute must match in the Target and Source OID .
The orclCommonNicknameAttribute must match on both the source and target OID. By default this attribute is set to "uid", so if this has been changed, it must be changed in both systems.
Reference Note 282698.1
Migration of custom Java portlets.
The script migrates all the data of Portal stored in the database. If you have custom java portlet deployed in your development machine, you will need to copy them in the production system.
Step 1 - Export in Development (DEV)
To export a full Portal installation to another machine, you need to follow 3 steps:
Export at the database level the portal schemas + related schemas
Get the midtier hostname and port of DEV
Export of the users and groups with LDAPSEARCH in 2 XML files
A script combining all the steps is available here.
A. Export the 4 portals schemas (DEV)
You need to export 3 types of database schemas:
The 4 portal schemas created by default by the portal installation :
portal,
portal_app,
portal_demo,
portal_public
The schemas where your custom database portlets / providers resides (if any)
- The custom schemas you have created for storing your portlet / provider code
The schemas where your custom tables resides. (if any)
- Your custom schemas accessed by portal and containing only data (tables, views ...)
You can get an approximate list of the schemas: default portal schemas (1) and database portlets schemas (2) with this query.
SELECT USERNAME, DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE
FROM DBA_USERS
WHERE USERNAME IN (user, user||'_PUBLIC', user||'_DEMO', user||'_APP')
OR USERNAME IN (SELECT DISTINCT OWNER FROM WWAPP_APPLICATION$ WHERE NAME != 'WWV_SYSTEM');
It still misses your custom schemas containing data only (3).
We will export the 4 schemas and your custom ones in an export file with the user sys.
Please, use a command like this one
exp userid="'sys/change_on_install@dev as sysdba'" file=portal_exp.dmp grants=y log=portal_exp.log owner=(portal,portal_app,portal_demo,portal_public)The result is a dump file: 'portal_exp.dmp'. If you are using a database 9.2.0.5 or 10.1.0.2, the database of the exp/imp dump file has changed. Please read this.
B. Hostname and port
For the URL to access the portal, you need the 2 following infos to run the script 'imp_portal_schema.sh below :
Webcache hostname
Webcache listen port
These values are contained in the iasconfig.xml file of the midtier.
iasconfig.xml
<IASConfig XSDVersion="1.0">
<IASInstance Name="ias904.dev.dev_domain.com" Host="dev.dev_domain.com" Version="9.0.4">
<OIDComponent AdminPassword="@BfgIaXrX1jYsifcgEhwxciglM+pXod0dNw==" AdminDN="cn=orcladmin" SSLEnabled="false" LDAPPort="3060"/>
<WebCacheComponent AdminPort="4037" ListenPort="7782" InvalidationPort="4038" InvalidationUsername="invalidator" InvalidationPassword="@BR9LXXoXbvW1iH/IEFb2rqBrxSu11LuSdg==" SSLEnabled="false"/>
<EMComponent ConsoleHTTPPort="1813" SSLEnabled="false"/>
</IASInstance>
<PortalInstance DADLocation="/pls/portal" SchemaUsername="portal" SchemaPassword="@BR9LXXoXbvW1c5ZkK8t3KJJivRb0Uus9og==" ConnectString="cn=asdb,cn=oraclecontext">
<WebCacheDependency ContainerType="IASInstance" Name="ias904.dev.dev_domain.com"/>
<OIDDependency ContainerType="IASInstance" Name="ias904.dev.dev_domain.com"/>
<EMDependency ContainerType="IASInstance" Name="ias904.dev.dev_domain.com"/>
</PortalInstance>
</IASConfig>
It corresponds to a portal URL like this:
http://dev.dev_domain.com:7782/pls/portalThe script exp_portal_schema.sh copy the iasconfig.xml file in the exp_data directory.
C. Export the security: users and groups (optional)
If you use other Single Sing-On uses than the portal user, you probably need to restore the full security, the users and groups stored in OID on the production machine. 5 steps need to be executed for this operation:
Export the OID entries with LDAPSEARCH
Before to import, change the domain in the generated file (optional)
Before to import, remove the 'authpassword' attributes from the generated files
Import them with LDAPADD
Update the GUID/DN of the groups in portal tables
Part 1 - LDAPSEARCH
The typical commands to do this operation look like this:
ldapsearch -h $OID_HOSTNAME -p $OID_PORT -X -b "cn=portal.040127.1384,cn=groups,dc=dev_domain,dc=com" -s sub "objectclass=*" > portal_group.xml
ldapsearch -h $OID_HOSTNAME -p $OID_PORT -X -D "cn=orcladmin" -w $IAS_PASSWORD -b "cn=users,dc=dev_domain,dc=com" -s sub "objectclass=inetorgperson" > portal_users.xmlTake care about the following points
The groups are stored in a LDAP directory containing the date of installation
( in this example: portal.040127.1384,cn=groups,dc=dev_domain,dc=com )
If the domain of dev and prod is different, the exported files contains the name of the development domain in the form of 'dc=dev_domain,dc=com' in a lot of place. The domain name needs to be replaced by the production domain name everywhere in the files.
Ldapsearch uses the option '- X '. It it to export to DSML files (XML). It avoids a problem related with common LDAP files, LDIF files. LDIF files are wrapped at 78 characters. The wrapping to 78 characters make difficult to change the domain name contained in the LDIF files. XML files are not wrapped and do not have this problem.
A sample script to export the 2 XML files is given here in : step 3 - export the users and groups (optional) of the export script.
Part 2 : change the domain in the DSML files
If the domain of dev and prod is different, the exported files contains the name of the development domain in the form of 'dc=dev_domain,dc=com' in a lot of place. The domain name need to be replaced by the production domain name everywhere in the files.
To do this, we can use these commands:
cat exp_data/portal_groups.xml | sed -e "s/$DEV_DN/$PROD_DN/" > imp_log/portal_groups.xml
cat exp_data/portal_users.xml | sed -e "s/$DEV_DN/$PROD_DN/" > imp_log/temp_users.xml
Part 3 : Remove the authpassword attribute
The export of all attributes from the all users has also exported an automatically generated attribute in OID called 'authpassword'.
'authpassword' is a list automatically generated passwords for several types of application. But mostly, it can not be imported. Also, there is no option in ldapsearch (that I know) that allows removing an attribute. In place of giving to the ldapsearch command the list of all the attributes that is very long, without 'authpassword', we will remove the attribute after the export.
For that we will use the fact that the DSML files are XML files. There is a XSLT in the Oracle IAS, in the executable '$ORACLE_HOME/bin/xml'. XSLT is a standard specification of the internet consortium W3C to transform a XML file with the help of a XSL file.
Here is the XSL file to remove the authpassword tag.
del_autpassword.xsl
<!--
File : del_authpassword.xsl
Version : 1.0
Author : mgueury
Description:
Remove the authpassword from the DSML files
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xml:output method="xml"/>
<xsl:template match="*|@*|node()">
<xsl:copy>
<xsl:apply-templates select="*|@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="attr">
<xsl:choose>
<xsl:when test="@name='authpassword;oid'">
</xsl:when>
<xsl:when test="@name='authpassword;orclcommonpwd'">
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="*|@*|node()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
And the command to make the transfomation:
xml -f -s del_authpassword.xsl -o imp_log/portal_users.xml imp_log/temp_users.xmlWhere :
imp_log/portal_users.xml is the final file without authpassword tags
imp_log/temp_users.xml is the input file with the authpassword tags that can not be imported.
Part 4 : LDAPADD
The typical commands to do this operation look like this:
ldapadd -h $OID_HOSTNAME -p $OID_PORT -D "cn=orcladmin" -w $IAS_PASSWORD -c -X portal_group.xml
ldapadd -h $OID_HOSTNAME -p $OID_PORT -D "cn=orcladmin" -w $IAS_PASSWORD -c -X portal_users.xmlTake care about the following points
Ldapadd uses the option ' -c '. Existing users/groups are generating an error. The option -c allows continuing and ignoring these errors. Whatever, the errors should be checked to see if it is just existing entries.
A sample script to import the 2 XML files given in the step 5 - import the users and groups (optional) of the import script.
Part 5 : Update the GUID/DN
In Portal 9.0.4, the update of the GUID is taken care by PTLCONFIG during the import. (Import step 7)
D. Example script for export
Here is a example script that combines the 3 steps.
Depending of you need, you will :
or execute all the steps
or just execute the 1rst one (export of the database users). It will be enough you just want to login with the portal user on the production instance.
if your portal repository resides in a database 9.2.0.5 or 10.1.0.2, please read this
you can download all the scripts here, Attachment 276688.1:1
Do not forget to modify the script to your need and mostly add the list of users like explained in point A above.
exp_portal_schema.sh
# BASH Script : exp_portal_schema.sh
# Version : 1.3
# Portal : 9.0.4.0
# History :
# mgueury - creation
# Description:
# This script export a portal dump file from a dev instance
# -------------------------- Environment variables --------------------------
. portal_env.sh
# In case you do not use portal_env.sh you have to define all the variables
# For exporting the dump file only.
# export SYS_PASSWORD=change_on_install
# export PORTAL_TNS=asdb
# For the security (optional)
# export IAS_PASSWORD=welcome1
# export PORTAL_USER=portal
# export PORTAL_PASSWORD=A1b2c3de
# export OID_HOSTNAME=development.domain.com
# export OID_PORT=3060
# export OID_DOMAIN_DN=dc=`echo $OID_HOSTNAME | cut -d '.' -f2,3,4,5,6 --output-delimiter=',dc='`
# ------------------------------ Help function -----------------------------------
function press_any_key() {
if [ $PRESS_ANY_KEY_AFTER_EACH_STEP = "Y" ]; then
echo
echo Press enter to continue
read $ANY_KEY
else
echo
fi
echo "------------------------------- Export ------------------------------------"
# create a directory for the export
mkdir exp_data
# copy the env variables in the log just in case
export > exp_data/exp_env_variable.txt
echo "--------------------- step 1 - export"
# export the portal users, but take care to add:
# - your users containing DB providers
# - your users containing data (tables)
exp userid="'sys/$SYS_PASSWORD@$PORTAL_TNS as sysdba'" file=exp_data/portal_exp.dmp grants=y log=exp_data/portal_exp.log owner=(portal,portal_app,portal_demo,portal_public)
press_any_key
echo "--------------------- step 2 - store iasconfig.xml file of the MIDTIER"
cp $MIDTIER_ORACLE_HOME/portal/conf/iasconfig.xml exp_data
press_any_key
echo "--------------------- step 3 - export the users and groups (optional)"
# Export the groups and users from OID in 2 XML files (not LDIF)
# The OID groups of portal are stored in GROUP_INSTALL_BASE that depends
# of the installation date.
# For the user, I use the default place. If it does not work,
# you can find the user place with:
# > exec dbms_output.put_line(wwsec_oid.get_user_search_base);
# Get the GROUP_INSTALL_BASE used in security export
sqlplus $PORTAL_USER/$PORTAL_PASSWORD@$PORTAL_TNS <<IASDB
set serveroutput on
spool exp_data/group_base.log
begin
dbms_output.put_line(wwsec_oid.get_group_install_base);
end;
IASDB
export GROUP_INSTALL_BASE=`grep cn= exp_data/group_base.log`
echo '--- Exporting Groups'
echo 'creating portal_groups.xml'
ldapsearch -h $OID_HOSTNAME -p $OID_PORT -X -s sub -b "$GROUP_INSTALL_BASE" -s sub "objectclass=*" > exp_data/portal_groups.xml
echo '--- Exporting Users'
echo 'creating portal_users.xml'
ldapsearch -h $OID_HOSTNAME -p $OID_PORT -D "cn=orcladmin" -w $IAS_PASSWORD -X -s sub -b "cn=users,$OID_DOMAIN_DN" -s sub "objectclass=inetorgperson" > exp_data/portal_users.xml
The script is done to run from the midtier.
Step 2 - Install IAS in a new machine (PROD)
A. Installation
This note does not distinguish if Portal is sharing the same database than Single-Sign On and OID. For simplicity, I will speak only about 1 database. But I could also create a second infrastructure database just for the portal repository. This way is better for production system, because the Portal repository is only product used in the 2nd database. Having 2 separate databases allows taking easily backup of the portal repository.
On the production machine, you need to install a fresh install of IAS 9.0.4. Take care to use :
the same IAS patchset 9.0.4.1, 9.0.4.2, ...on the middle-tier and infrastruture than in development
and same characterset than in development (or UTF8)
The result will be 2 ORACLE_HOMES and 1 infrastructure database:
the ORACLE_HOME of the infrastructure (SID:infra904)
the ORACLE_HOME of the midtier (SID:ias904)
an infrastructure database (SID:asdb)
The empty new Portal install should work fine before to go to the next step.
B. About tablespaces (optional)
The size of the tablespace of the production should match the one of the Developement machine. If not, the tablespace will autoextend. It is not really a concern, but it is slow. You should modify the tablespaces for to have as much space on prod and dev.
Also, it is safer to check that there is enough free space on the hard disk to import in the database.
To modify the tablespace size, you can use Oracle Entreprise Manager console,
On Unix, . oraenv
infra904oemapp dbastudio
On NT Start/ Programs/ Oracle Application server - infra904 / Enterprise Manager Console
Launch standalone
Choose the portal database (typically asdb.domain.com)
Connect with a DBA user, sys or system
Click Storage/Tablespaces
Change the size of the PORTAL, PORTAL_DOC, PORTAL_LOGS, PORTAL_IDX tablespaces
C. Backup
It could be a good idea to take a backup of the MIDTIER and INFRASTRUCTURE Oracle Homes at that point to allow retesting the import process if it fails for any reason as much as you want without needing to reinstall everything.
Step 3 - Import in production (on PROD)
The following script is a sample of an Unix script that combines all the steps to import a portal repository to the production machine.
To import a portal reporistory and his users and group in OID, you need to do 8 things:
Stop the midtier to avoid errors while dropping the portal schema
SQL*Plus with Portal
Drop the 4 default portal schemas
Create the portal users with the same passwords than the just deleted users and give them grants (you need to create your own custom shemas too if you have some).
Import the dump file
Import the users and groups into OID (optional)
SQL*Plus with SYS : Post import changes
Recompile everything in the database
Reassign the imported jobs to portal
SQL*Plus with Portal : Post import changes
Recreate the Portal intermedia indexes
Correct an import errror on wwsrc_preference$
Make additional post import changes, by updating some portal tables, and replacing the development hostname, port or domain by the production ones.
Rewire the portal repository with ptlconfig -dad portal
Restart the midtier
Here is a sample script to do this on Unix. You will need to adapt the script to your needs.
imp_portal_schema.sh
# BASH Script : imp_portal_schema.sh
# Version : 1.3
# Portal : 9.0.4.0
# History :
# mgueury - creation
# Description:
# This script import a portal dump file and relink it with an
# infrastructure.
# Script to be started from the MIDTIER
# -------------------------- Environment variables --------------------------
. portal_env.sh
# Development and Production machine hostname and port
# Example
# .._HOSTNAME machine.domain.com (name of the MIDTIER)
# .._PORT 7782 (http port of the MIDTIER)
# .._DN dc=domain,dc=com (domain name in a LDAP way)
# These values can be determined automatically with the iasconfig.xml file of dev
# and prod. But if you do not know or remember the dev hostname and port, this
# query should find it.
# > select name, http_url from wwpro_providers$ where http_url like 'http%'
# These variables are used in the
# > step 4 - security / import OID users and groups
# > step 6 - post import changes (PORTAL)
# Set the env variables of the DEV instance
rm /tmp/iasconfig_env.sh
xml -f -s xsl/portal_env_unix.xsl -o /tmp/iasconfig_env.sh exp_data/iasconfig.xml
. /tmp/iasconfig_env.sh
export DEV_HOSTNAME=$WEBCACHE_HOSTNAME
export DEV_PORT=$WEBCACHE_LISTEN_PORT
export DEV_DN=dc=`echo $OID_HOSTNAME | cut -d '.' -f2,3,4,5,6 --output-delimiter=',dc='`
# Set the env variables of the PROD instance
. portal_env.sh
export PROD_HOSTNAME=$WEBCACHE_HOSTNAME
export PROD_PORT=$WEBCACHE_LISTEN_PORT
export PROD_DN=dc=`echo $OID_HOSTNAME | cut -d '.' -f2,3,4,5,6 --output-delimiter=',dc='`
# ------------------------------ Help function -----------------------------------
function press_any_key() {
if [ $PRESS_ANY_KEY_AFTER_EACH_STEP = "Y" ]; then
echo
echo Press enter to continue
read $ANY_KEY
else
echo
fi
echo "------------------------------- Import ------------------------------------"
# create a directory for the logs
mkdir imp_log
# copy the env variables in the log just in case
export > imp_log/imp_env_variable.txt
echo "--------------------- step 1 - stop the midtier"
# This step is needed to avoid most case of ORA-01940: user connected
# when dropping the portal user
$MIDTIER_ORACLE_HOME/opmn/bin/opmnctl stopall
press_any_key
echo "--------------------- step 2 - drop and create empty users"
sqlplus "sys/$SYS_PASSWORD@$PORTAL_TNS as sysdba" <<IASDB
spool imp_log/drop_create_user.log
---- Drop users
-- Warning: You need to stop all SQL*Plus connection to the
-- portal schema before that else the drop will give an
-- ORA-01940: cannot drop a user that is currently connected
drop user portal_public cascade;
drop user portal_app cascade;
drop user portal_demo cascade;
drop user portal cascade;
---- Recreate the users and give them grants"
-- The new users will have the same passwords as the users we just dropped
-- above. Do not forget to add your exported custom users
create user portal identified by $PORTAL_PASSWORD default tablespace portal;
grant connect,resource,dba to portal;
create user portal_app identified by $PORTAL_APP_PASSWORD default tablespace portal;
grant connect,resource to portal_app;
create user portal_demo identified by $PORTAL_DEMO_PASSWORD default tablespace portal;
grant connect,resource to portal_demo;
create user portal_public identified by $PORTAL_PUBLIC_PASSWORD default tablespace portal;
grant connect,resource to portal_public;
alter user portal_public grant connect through portal;
start $MIDTIER_ORACLE_HOME/portal/admin/plsql/wwv/wdbigra.sql portal
exit
IASDB
press_any_key
echo "--------------------- step 3 - import"
imp userid="'sys/$SYS_PASSWORD@$PORTAL_TNS as sysdba'" file=exp_data/portal_exp.dmp grants=y log=imp_log/import.log full=y
press_any_key
echo "--------------------- step 4 - import the OID users and groups (optional)"
# Some errors will be raised when running the ldapadd because at least the
# default entries will not be able to be inserted. Remove them from the
# ldif file if you want to avoid them. Due to the flag '-c', ldapadd ignores
# duplicate entries. Another more radical solution is to erase all the entries
# of the users and groups in OID before to run the import.
# Replace the domain name in the XML files.
cat exp_data/portal_groups.xml | sed -e "s/$DEV_DN/$PROD_DN/" > imp_log/portal_groups.xml
cat exp_data/portal_users.xml | sed -e "s/$DEV_DN/$PROD_DN/" > imp_log/temp_users.xml
# Remove the authpassword attributes with a XSL stylesheet
xml -f -s xsl/del_authpassword.xsl -o imp_log/portal_users.xml imp_log/temp_users.xml
echo '--- Importing Groups'
ldapadd -h $OID_HOSTNAME -p $OID_PORT -D "cn=orcladmin" -w $IAS_PASSWORD -c -X imp_log/portal_groups.xml -v
echo '--- Importing Users'
ldapadd -h $OID_HOSTNAME -p $OID_PORT -D "cn=orcladmin" -w $IAS_PASSWORD -c -X imp_log/portal_users.xml -v
press_any_key
echo "--------------------- step 5 - post import changes (SYS)"
sqlplus "sys/$SYS_PASSWORD@$PORTAL_TNS as sysdba" <<IASDB
spool imp_log/sys_post_changes.log
---- Recompile the invalid packages"
-- On the midtier, the script utlrp is not present. This step
-- uses a copy of it stored in patch/utlrp.sql
select count(*) INVALID_OBJECT_BEFORE from all_objects where status='INVALID';
start patch/utlrp.sql
set lines 999
select count(*) INVALID_OBJECT_AFTER from all_objects where status='INVALID';
---- Jobs
-- Reassign the JOBS imported to PORTAL. After the import, they belong
-- incorrectly to the user SYS.
update dba_jobs set LOG_USER='PORTAL', PRIV_USER='PORTAL' where schema_user='PORTAL';
commit;
exit
IASDB
press_any_key
echo "--------------------- step 6 - post import changes (PORTAL)"
sqlplus $PORTAL_USER/$PORTAL_PASSWORD@$PORTAL_TNS <<IASDB
set serveroutput on
spool imp_log/portal_post_changes.log
---- Intermedia
-- Recreate the portal indexes.
-- inctxgrn.sql is missing from the 9040 CD-ROMS. This is the bug 3536937.
-- Fixed in 9041. The missing script is contained in the downloadable zip file.
start patch/inctxgrn.sql
start $MIDTIER_ORACLE_HOME/portal/admin/plsql/wws/ctxcrind.sql
---- Import error
alter table "WWSRC_PREFERENCE$" add constraint wwsrc_preference_pk
primary key (subscriber_id, id)
using index wwsrc_preference_idx1
begin
DBMS_RLS.ADD_POLICY ('', 'WWSRC_PREFERENCE$', 'WEBDB_VPD_POLICY',
'', 'webdb_vpd_sec', 'select, insert, update, delete', TRUE,
static_policy=>true);
end ;
---- Modify tables with full URLs
-- If the domain name of prod and dev are different, this step is really important.
-- It modifies the portal tables that contains reference to the hostname or port
-- of the development machine. (For more explanation: see Addional steps in the note)
-- groups (dn)
update wwsec_group$
set dn=replace( dn, '$DEV_DN', '$PROD_DN' )
update wwsec_group$
set dn_hash = wwsec_api_private.get_dn_hash( dn )
-- users (dn)
update wwsec_person$
set dn=replace( dn, '$DEV_DN', '$PROD_DN' )
update wwsec_person$
set dn_hash = wwsec_api_private.get_dn_hash( dn)
-- subscriber
update wwsub_model$
set dn=replace( dn, '$DEV_DN', '$PROD_DN' ), GUID=':1'
where dn like '%$DEV_DN%'
-- preferences
update wwpre_value$
set varchar2_value=replace( varchar2_value, '$DEV_DN', '$PROD_DN' )
where varchar2_value like '%$DEV_DN%'
update wwpre_value$
set varchar2_value=replace( varchar2_value, '$DEV_HOSTNAME:$DEV_PORT', '$PROD_HOSTNAME:$PROD_PORT' )
where varchar2_value like '%$DEV_HOSTNAME:$DEV_PORT%'
-- page url items
update wwv_things
set title_link=replace( title_link, '$DEV_HOSTNAME:$DEV_PORT', '$PROD_HOSTNAME:$PROD_PORT' )
where title_link like '%$DEV_HOSTNAME:$DEV_PORT%'
-- web providers
update wwpro_providers$
set http_url=replace( http_url, '$DEV_HOSTNAME:$DEV_PORT', '$PROD_HOSTNAME:$PROD_PORT' )
where http_url like '%$DEV_HOSTNAME:$DEV_PORT%'
-- html links created by the RTF editor inside text items
update wwv_text
set text=replace( text, '$DEV_HOSTNAME:$DEV_PORT', '$PROD_HOSTNAME:$PROD_PORT' )
where text like '%$DEV_HOSTNAME:$DEV_PORT%'
-- Portlet metadata nls: help URL
update wwpro_portlet_metadata_nls$
set help_url=replace( help_url, '$DEV_HOSTNAME:$DEV_PORT', '$PROD_HOSTNAME:$PROD_PORT' )
where help_url like '%$DEV_HOSTNAME:$DEV_PORT%'
-- URL items (There is a trigger on this table building absolute_url automatically)
update wwsbr_url$
set absolute_url=replace( absolute_url, '$DEV_HOSTNAME:$DEV_PORT', '$PROD_HOSTNAME:$PROD_PORT' )
where absolute_url like '%$DEV_HOSTNAME:$DEV_PORT%'
-- Things attributes
update wwv_thingattributes
set value=replace( value, '$DEV_HOSTNAME:$DEV_PORT', '$PROD_HOSTNAME:$PROD_PORT' )
where value like '%$DEV_HOSTNAME:$DEV_PORT%'
commit;
exit
IASDB
press_any_key
echo "--------------------- step 7 - ptlconfig"
# Configure portal such that portal uses the infrastructure database
cd $MIDTIER_ORACLE_HOME/portal/conf/
./ptlconfig -dad portal
cd -
mv $MIDTIER_ORACLE_HOME/portal/logs/ptlconfig.log imp_log
press_any_key
echo "--------------------- step 8 - restart the midtier"
$MIDTIER_ORACLE_HOME/opmn/bin/opmnctl startall
date
Each step can generate his own errors due to a lot of factors. It is better to run the import step by step the first time.
Do not forget to check the output of log files created during the various steps of the import:
imp_log/drop_create_user.log
Spool when dropping and recreating the portal users
imp_log/import.log Import log file when importing the portal_exp.dmp file
imp_log/sys_post_changes.log
Spool when making post changes with SYS
imp_log/portal_post_changes.log
Spool when making post changes with PORTAL
imp_log/ptlconfig.log
Log file of ptconfig when rewiring the midtier
Step 4 - Test
A. Check the log files
B. Test the website and see if it works fine.
Step 5 - take a backup
Take a backup of all ORACLE_HOME and DATABASES to prevent all hardware problems. You need to copy:
All the files of the 2 ORACLE_HOME
And all the database files.
Step 6 - Additional steps
Here are some additional steps.
SSO external application ( that are part of the orasso schema and not imported yet )
Page URL items ( they seems to store the full URL ) - included in imp_portal_schema.sh
Web Providers ( the URL needs to be changed ) - included in imp_portal_schema.sh
Text items edited with the RTF editor in IE and containing links - included in imp_portal_schema.sh
Most of them are taken care by the "step 8 - post import changes". Except the first one.
1. SSO import
This script imports only Portal and the users/groups of OID. Not the list of the external application contained in the orasso user.
In Portal 9.0.4, there is a script called SSOMIG that resides in $INFRA_ORACLE_HOME/sso/bin and allows to move :
Definitions and user data for external applications
Registration URLs and tokens for partner applications
Connection information used by OracleAS Discoverer to access various data sources
See:
Oracle® Application Server Single Sign-On Administrator's Guide 10g (9.0.4) Part Number B10851-01
14. Exporting and Importing Data
2. Page items: the page URL items store the full URL.
This is Bug 2661805 fixed in Portal 9.0.2.6.
This following work-around is implemented in post import step of imp_portal_schema.sh
-- page url items
update wwv_things
set title_link=replace( title_link, 'dev.dev_domain.com:7778', 'prod.prod_domain.com:7778' )
where title_link like '%$DEV_HOSTNAME:$DEV_PORT%'
2. Web Providers
The URL to the Web providers needs also change. Like for the Page items, they contain the full path of the webserver.
Or you can get the list of the URLs to change with this query
select name, http_url from PORTAL.WWPRO_PROVIDERS$ where http_url like '%';
This following work-around is implemented in post import step of imp_portal_schema.sh
-- web providers
update wwpro_providers$
set http_url=replace( http_url, 'dev.dev_domain.com:7778', 'prod.prod_domain.com:7778' )
where http_url like '%$DEV_HOSTNAME:$DEV_PORT%'
4. The production and development machine do not share the same domain
If the domain of the production and the development are not the same, the DN (name in LDAP) of all users needs to change.
Let's say from
dc=dev_domain,dc=com -> dc=prod_domain,dc=com
1. before to upload the ldif files. All the strings in the 2 ldifs files that contain 'dc=dev_domain,dc=com', have to be replaced by 'dc=prod_domain,dc=com'
2. in the wwsec_group$ and wwsec_person$ tables in portal, the DN need to change too.
This following work-around is implemented in post import step of imp_portal_schema.sh
-- groups (dn)
update wwsec_group$
set dn=replace( dn, 'dc=dev_domain,dc=com', 'dc=prod_domain,dc=com' )
update wwsec_group$
set dn_hash = wwsec_api_private.get_dn_hash( dn )
-- users (dn)
update wwsec_person$
set dn=replace( dn, 'dc=dev_domain,dc=com', 'dc=prod_domain,dc=com' )
update wwsec_person$
set dn_hash = wwsec_api_private.get_dn_hash( dn)
5. Text items with HTML links
Sometimes people stores full URL inside their text items, it happens mostly when they use link with the RichText Editor in IE .
This following work-around is implemented in post import step in imp_portal_schema.sh
-- html links created by the RTF editor inside text items
update wwv_text
set text=replace( text, 'dev.dev_domain.com:7778', 'prod.prod_domain.com:7778' )
where text like '%$DEV_HOSTNAME:$DEV_PORT%'
6. OID Custom password policy
It happens quite often that the people change the password policy of the OID server. The reason is that with the default policy, the password expires after 60 days. If so, do not forget to make the same changes in the new installation.
PROBLEMS
1. Import log has some errors
A. EXP-00091 -Exporting questionable statistics
You can ignore this error.
B. IMP-00017 - WWSRC_PREFERENCE$
When importing, there is one import error:
IMP-00017: following statement failed with ORACLE error 921:
"ALTER TABLE "WWSRC_PREFERENCE$" ADD "
IMP-00003: ORACLE error 921 encountered
ORA-00921: unexpected end of SQL commandThe primary key is not created. You can create it with this commmand
in SQL*Plus with the user portal.. Then readd the missing VPD policy.
alter table "WWSRC_PREFERENCE$" add constraint wwsrc_preference_pk
primary key (subscriber_id, id)
using index wwsrc_preference_idx1
begin
DBMS_RLS.ADD_POLICY ('', 'WWSRC_PREFERENCE$', 'WEBDB_VPD_POLICY',
'', 'webdb_vpd_sec', 'select, insert, update, delete', TRUE,
static_policy=>true);
end ;
Step 8 in the script "imp_portal_schema.sh" take care of this. This can also possibly be solved by the
C. IMP-00017 - WWDAV$ASL
. importing table "WWDAV$ASL"
Note: table contains ROWID column, values may be obsolete 113 rows importedThis error is normal, the table really contains a ROWID column.
D. IMP-00041 - Warning: object created with compilation warnings
This error is normal too. The packages giving these error have
dependencies on package not yet imported. A recompilation is done
after the import.
E. ldapadd error 'cannot add add entries containing authpasswords'
# ldap_add: DSA is unwilling to perform
# ldap_add: additional info: You cannot add entries containing authpasswords.
"authpasswords" are automatically generated values from the real password of the user stored in userpassword. These values do not have to be exported from ldap.
In the import script, I remove the additional tag with a XSL stylesheet 'del_authpassword.xsl'. See above.
F. IMP-00017: WWSTO_SESSION$
IMP-00017: following statement failed with ORACLE error 2298:
"ALTER TABLE "WWSTO_SESSION$" ENABLE CONSTRAINT "WWSTO_SESS_FK1""
IMP-00003: ORACLE error 2298 encountered
ORA-02298: cannot validate (PORTAL.WWSTO_SESS_FK1) - parent keys not found
Here is a work-around for the problem. I will normally integrate it in a next version of the scripts.
SQL> delete from WWSTO_SESSION_DATA$;
7690 rows deleted.
SQL> delete from WWSTO_SESSION$;
1073 rows deleted.
SQL> commit;
Commit complete.
SQL> ALTER TABLE "WWSTO_SESSION$" ENABLE CONSTRAINT "WWSTO_SESS_FK1";
Table altered.
G. IMP-00017 - ORACLE error 1 - DBMS_JOB.ISUBMIT
This error can appear during the import when the import database is not empty and is already customized for some reasons. For example, you export from an infrastructure and you import in a database with a lot of other programs that uses jobs. And unhappily the same job id.
Due to the way the export/import of jobs is done, the jobs keeps their id after the import. And they may conflict.
IMP-00017: following statement failed with ORACLE error 1: "BEGIN DBMS_JOB.ISUBMIT(JOB=>42,WHAT=>'begin execute immediate " "''begin wwutl_cache_sys.process_background_inval; end;'' ; exc" "eption when others then wwlog_api.log(p_domain=> ''utl'', " " p_subdomain=>''cache'', p_name=>''background'', " " p_action=>''process_background_inval'', p_information => ''E" "rror in process_background_inval ''|| sqlerrm);end;', NEXT_DATE=" ">TO_DATE('2004-08-19:17:32:16','YYYY-MM-DD:HH24:MI:SS'),INTERVAL=>'SYSDATE " "+ 60/(24*60)',NO_PARSE=>TRUE); END;"
IMP-00003: ORACLE error 1 encountered ORA-00001: unique constraint (SYS.I_JOB_JOB) violated
ORA-06512: at "SYS.DBMS_JOB", line 97 ORA-06512: at line 1
Solutions:
1. use a fresh installed database,
2. Due that the jobs conflicting are different because it happens only in custom installation, there is no clear rule. But you can
recreate the jobs lost after the import with other_ids
and/or change the job id of the other program before to import. This type of commands can help you (you need to do it with SYS)
select * from dba_jobs;
update dba_jobs set job=99 where job=52;
commit
2. Import in a RAC environment
Be aware of the Bug 2479882 when the portal database is in a RAC database.
Bug 2479882 : NEEDED TO BOUNCE DB NODES AFTER INSTALLING PORTAL 9.0.2 IN RAC NODE3. Intermedia
After importing a environment, the intermedia indexes are invalid. To correct the error you need to run in SQL*Plus with Portal
start $MIDTIER_ORACLE_HOME/portal/admin/plsql/wws/inctxgrn.sql
start $MIDTIER_ORACLE_HOME/portal/admin/plsql/wws/ctxcrind.sql
But $MIDTIER_ORACLE_HOME/portal/admin/plsql/wws/inctxgrn.sql is missing in IAS 9.0.4.0. This is Bug 3536937. Fixed in 9041. The missing scripts are contained in the downloadable zip file (exp_schema904.zip : Attachment 276688.1:1 ), directory sql. This means that practically in 9040, you have to run
start sql/inctxgrn.sql
start $MIDTIER_ORACLE_HOME/portal/admin/plsql/wws/ctxcrind.sql
In the import script, it is done in the step 6 - recreate Portal Intermedia indexes.
You can not WA the problem without the scripts. Running ctxcrind.sql alone does not work. You will have this error:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "PORTAL.WWERR_API_EXCEPTION", line 164
ORA-06512: at "PORTAL.WWV_CONTEXT", line 1035
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "PORTAL.WWERR_API_EXCEPTION", line 164
ORA-06512: at "PORTAL.WWV_CONTEXT", line 476
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-20000: Oracle Text error:
DRG-12603: CTXSYS does not own user datastore procedure: WWSBR_THING_CTX_69
ORA-06512: at line 13
4. ptlconfig
If you try to run ptlconfig simply after an import you will get an error:
Problem processing Portal instance: Configuring HTTP server settings : Installing cache data : SQL exception: ERROR: ORA-23421: job number 32 is not a job in the job queue
This is because the import done by user SYS has imported the PORTAL jobs to the SYS schema in place of portal. The solution is to run
update dba_jobs set LOG_USER='PORTAL', PRIV_USER='PORTAL' where schema_user='PORTAL';
In the import script, it is done in the step 8 - post import changes.
5. WWC-41417 - invalid credentials.
When you try to login you get:
Unexpected error encountered in wwsec_app_priv.process_signon (User-Defined Exception) (WWC-41417)
An exception was raised when accessing the Oracle Internet Directory: 49: Invalid credentials
Details
Error:Operation: dbms_ldap.simple_bind_s
OID host: machine.domain.com
OID port number: 4032
Entry DN: orclApplicationCommonName=PORTAL,cn=Portal,cn=Products,cn=OracleContext. (WWC-41743)Solution:
- run secupoid.sql
- rerun ptlconfig
This problem has been seen after using ptlasst in place of ptlconfig.
6. EXP-003 with a database 9.2.0.5 or 10.1.0.2
In fact, the DB format of imp/exp has changed in 9.2.0.5 or 10.1.0.2. The EXP-3 error only occurs when the export from the 9.2.0.5.0 or 10.1.0.2.0 database is done with a lower release export utility, e.g. 9.2.0.4.0.
Due to the way this note is written, the imp/exp utility used is the one of the midtier (9014), if your portal resides in a 9.2.0.5 database, it will not work. To work-around the problem, there are 2 solutions:
Change the script so that it uses the exp and imp command of database.
Make a change to the 9.2.0.5 or 10.1.0.2 database to make them compatible with previous version. The change is to modify a database internal view before to export/import the data.
A work-around is given in Bug 3784697
1. Make a note of the export definition of exu9tne from
$OH/rdbms/admin/catexp.sql
2. Copy this to a new file and add "UNION ALL select * from sys.exu9tneb" to the end of the definition
3. Run this as sys against the DB to be exported.
4. Export as required
5. Put back the original definition of exu9tne
eg: For 9204 the workaround view would be:
CREATE OR REPLACE VIEW exu9tne (
tsno, fileno, blockno, length) AS
SELECT ts#, segfile#, segblock#, length
FROM sys.uet$
WHERE ext# = 1
UNION ALL
select * from sys.exu9tneb
7. EXP-00006: INTERNAL INCONSISTENCY ERROR
This is Bug 2906613.
The work-around given in this bug is the following:
- create the following view, connected as sys, before running export:
CREATE OR REPLACE VIEW exu8con (
objid, owner, ownerid, tname, type, cname,
cno, condition, condlength, enabled, defer,
sqlver, iname) AS
SELECT o.obj#, u.name, c.owner#, o.name,
decode(cd.type#, 11, 7, cd.type#),
c.name, c.con#, cd.condition, cd.condlength,
NVL(cd.enabled, 0), NVL(cd.defer, 0),
sv.sql_version, NVL(oi.name, '')
FROM sys.obj$ o, sys.user$ u, sys.con$ c,
sys.cdef$ cd, sys.exu816sqv sv, sys.obj$ oi
WHERE u.user# = c.owner# AND
o.obj# = cd.obj# AND
cd.con# = c.con# AND
cd.spare1 = sv.version# (+) AND
cd.enabled = oi.obj# (+) AND
NOT EXISTS (
SELECT owner, name
FROM sys.noexp$ ne
WHERE ne.owner = u.name AND
ne.name = o.name AND
ne.obj_type = 2)
The modification of exu8con simply adds support for a constraint type that had not previously been supported by this view. There is no negative impact.
8. WWSBR_DOC_CTX_54 is invalid
After the recompilation of the package, one package remains invalid (in sys_post_changes.log):
INVALID_OBJECT_AFTER
1
select owner, object_name from all_objects where status='INVALID'
CTXSYS WWSBR_DOC_CTX_54
CREATE OR REPLACE procedure WWSBR_DOC_CTX_54
(rid in rowid, bilob in out NOCOPY blob)
is begin PORTAL.WWSBR_CTX_PROCS.DOC_CTX(rid,bilob);end;
This object is not used anymore by portal. The error can be ignored. The procedure can be removed too. This is Bug 3559731.
9. You do not have permission to perform this operation. (WWC-44131)
It seems that there are problems if
- groups on the production machine are not residing in the default place in OID,
- and that the group creation base and group search base where changed.
After this, the cloning of the repository work without problem. But it seems that the command 'ptlconfig -dad portal' does not reset the GUID and DN of the groups correctly. I have not checked this yet.
The solution seems to use the script given in the 9.0.2 Note 228516.1. And run group_sec.sql to reset all the DN and GUID in the copied instance.
10. Invalid Java objects when exporting from a 9.x database and importing in a 10g database
If you export from a 9.x database and import in a 10g database, after running utlrp.sql, 18 Java objects will be invalid.
select object_name, object_type from user_objects where status='INVALID'
SQL> /
OBJECT_NAME OBJECT_TYPE
/556ab159_Handler JAVA CLASS
/41bf3951_HttpsURLConnection JAVA CLASS
/ce2fa28e_ProviderManagerClien JAVA CLASS
/c5b98d35_ServiceManagerClient JAVA CLASS
/d77cf2ab_SOAPServlet JAVA CLASS
/649bf254_JavaProvider JAVA CLASS
/a9164b8b_SpProvider JAVA CLASS
/2ee43ac9_StatefulEJBProvider JAVA CLASS
/ad45acec_StatelessEJBProvider JAVA CLASS
/da1c4a59_EntityEJBProvider JAVA CLASS
/66fdac3e_OracleSOAPHTTPConnec JAVA CLASS
/939c36f5_OracleSOAPHTTPConnec JAVA CLASS
org/apache/soap/rpc/Call JAVA CLASS
org/apache/soap/rpc/RPCMessage JAVA CLASS
org/apache/soap/rpc/Response JAVA CLASS
/198a7089_Message JAVA CLASS
/2cffd799_ProviderGroupUtils JAVA CLASS
/32ebb779_ProviderGroupMgrProx JAVA CLASS
18 rows selected.
This is a known issue. This can be solved by applying patch one of the following patch depending of your IAS version.
Bug 3405173 - PORTAL 9.0.4.0.0 PATCH FOR 10G DB UPGRADE (FROM 9.0.X AND 9.2.X)
Bug 4100409 - PORTAL 9.0.4.1.0 PATCH FOR 10G DB UPGRADE (FROM 9.0.X AND 9.2.X)
Bug 4100417 - PORTAL 9.0.4.2.0 PATCH FOR 10G DB UPGRADE (FROM 9.0.X AND 9.2.X)
11. Import : IMP-00003: ORACLE error 30510 encountered
When importing Portal 9.0.4.x, it could be that the import of the database side produces an error ORA-30510.The new perl script work-around the issue in the portal_post_import.sql script. But not the BASH scripts. If you use the BASH scripts, after the import, please run this command manually in SQL*Plus logged as portal.
---- Import error 2 - ORA-30510 when importing
CREATE OR REPLACE TRIGGER logoff_trigger
before logoff on schema
begin
-- Call wwsec_oid.unbind to close open OID connections if any.
wwsec_oid.unbind;
exception
when others then
-- Ignore all the errors encountered while unbinding.
null;
end logoff_trigger;
This is logged as <Bug;4458413>.
12. Exporting from a 9.0.1 database and import in a 9.2.0.5+ or 10g DB
It could be that when exporting from a 9.0.1 database to a 10g database that the java classes do not get compiled correctly. The following errors are seen
ORA-29534: referenced object PORTAL.oracle/net/www/proto/https/HttpsURLConnection could not be resolved
errors:: class oracle/net/www/proto/https/HttpsURLConnection
ORA-29521: referenced name oracle/security/ssl/OracleSSLSocketFactoryImpl could not be found
ORA-29521: referenced name oracle/security/ssl/OracleSSLSocketFactory could not be found
In such a case, please apply the following patches after the import in the 10g database.
Bug 3405173 PORTAL REPOS DB UPGRADE TO 10G: for Portal 9.0.4.0
Bug 4100409 PORTAL REPOS DB UPGRADE TO 10G: for Portal 9.0.4.1
Main Differences with Portal 9.0.2
For the persons used to this technics in Portal 9.0.2, you could be interested to read the main differences with the same note for Portal 9.0.2
Portal 9.0.2
Portal 9.0.4
Cutter database
Portal 9.0.2 can be part of an infrastructure database or in a custom external database.
In Portal 9.0.2, the portal schema is imported in an empty database.
Portal 9.0.4 can only be installed in a 'Cutter database', a database created with RepCA or OUI containing always OID, DCM and so on...
In Portal 9.0.4, the portal schema is imported in an 'Cutter database' (new)
group_sec.sql
group_sec.sql is used to correct the GUIDs of OID stored in Portal
ptlconfig -dad portal -oid is used to correct the GUIDs of OID stored in Portal (new)
1 script
The import / export are divided by several steps with several scripts
The import script is done in one step
Additional steps are included in the script
This requires to know the hostname and port of the original development machine. (new)
Import
The steps are:
creation of an empty database
creation of the users with password=username
import
The steps are:
creation of an IAS 10g infrastructure DB (repca or OUI)
deletion of new portal schemas (new)
creation of the users with the same password than the schemas just dropped.
import
DAD
The dad needed to be changed
The passwords are not changed, the dad does not need to be changed.
Bugs
In portal 9.0.2, 2 bugs were workarounded by change_host.sh
In Portal 9.0.4, some tables additional tables needs to be updated manually before to run ptlasst. This is #Bug:3762961#.
export of LDAP
The export is done in LDIF files. If the prod and the dev have different domain, it is quite difficult to change the domain name in these file due to the line wrapping at 78 characters.
The export is done in XML files, in the DSML format (new). It is a lot easier to change the XML files if the domain name is different from PROD to DEV.
Download
You have to cut and paste the scripts
The scripts are attached to the note. Just donwload them.
Rewiring
9.0.2 uses ptlasst.
ptlasst.csh -mode MIDTIER -i custom -s $PORTAL_USER -sp $PORTAL_PASSWORD -c $PORTAL_HOSTNAME:$PORTAL_DB_PORT:$PORTAL_SERVICE_NAME -sdad $PORTAL_DAD -o orasso -op $ORASSO_PASSWORD -odad orasso -host $MIDTIER_HOSTNAME -port $MIDTIER_HTTP_PORT -ldap_h $INFRA_HOSTNAME -ldap_p $OID_PORT -ldap_w $IAS_PASSWORD -pwd $IAS_PASSWORD -sso_c $INFRA_HOSTNAME:$INFRA_DB_PORT:$INFRA_SERVICE_NAME -sso_h $INFRA_HOSTNAME -sso_p $INFRA_HTTP_PORT -ultrasearch -oh $MIDTIER_ORACLE_HOME -mc false -mi true -chost $MIDTIER_HOSTNAME -cport_i $WEBCACHE_INV_PORT -cport_a $WEBCACHE_ADM_PORT -wc_i_pwd $IAS_PASSWORD -emhost $INFRA_HOSTNAME -emport $EM_PORT -pa orasso_pa -pap $ORASSO_PA_PASSWORD -ps orasso_ps -pp $ORASSO_PS_PASSWORD -iasname $IAS_NAME -verbose -portal_only
9.0.4 uses ptlconfig (new)
ptlconfig -dad portal
Environment variables
A lot of environment variables are needed
Just 3 environment variables are needed:
- password of SYS
- password of IAS,
- ORACLE_HOME of the Midtier
All the rest is found in iasconfig.xml and LDAP (new)
TO DO
- Check if the orclcommonapplication name fits SID.hostname
- Check what gives the import of a portal30 upgraded schema inside a schema named portal
- Explain how to copy the portal*.dbf files in place of export/import and the limitation of tra -
SQL> SELECT JOB FROM DBA_JOBS;
JOB
1
SQL> EXEC DBMS_JOB.REMOVE(1);
BEGIN DBMS_JOB.REMOVE(1); END;
ERROR at line 1:
ORA-23421: job number 1 is not a job in the job queue
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_IJOB", line 529
ORA-06512: at "SYS.DBMS_JOB", line 171
ORA-06512: at line 1
The job wasn't created successfully in the first place, but it wouldn't let me drop it either !! What may be the problem ?
ThanksSQL> SELECT SCHEMA_USER,JOB FROM DBA_JOBS;
SCHEMA_USER JOB
SYSMAN 1
Not sure, what this is. Looks like it is not my job. However, I still have errors executing my procedure...
Or let me get back to square one.
What I am trying to do is to execute this :
The file name is group1_dbms_script.sql (I am trying to just export the group1_tab1 and group1_tab2 tables which are present in the CLIENT schema,,,that's all i needed... but using this dbms_datapump API)
declare
l_dp_handle NUMBER;
begin
l_dp_handle := DBMS_DATAPUMP.open(
operation => 'EXPORT',
job_mode => 'TABLE',
remote_link => NULL,
job_name => 'group1',
version => 'LATEST'
DBMS_DATAPUMP.add_file(
handle => l_dp_handle,
filename => 'group1.dmp',
directory => 'EXPORT_DIR'
DBMS_DATAPUMP.add_file(
handle => l_dp_handle,
filename => 'group1.log',
directory => 'EXPORT_DIR',
filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE
DBMS_DATAPUMP.metadata_filter(
handle => l_dp_handle,
name => 'SCHEMA_EXPR',
value => 'IN (''CLIENT'')');
DBMS_DATAPUMP.metadata_filter(
handle => l_dp_handle,
name => 'NAME_EXPR',
value => 'IN (''GROUP1_TAB1'',
''GROUP1_TAB2'')');
DBMS_DATAPUMP.start_job(l_dp_handle);
DBMS_DATAPUMP.detach(l_dp_handle);
END;
When i do (in sqlplus)
@group1_dbms_script.sql
I am getting
ERROR at line 1:
ORA-31634: job already exists
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 911
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4354
ORA-06512: at line 4
Please help. I haven't used this API before, hence not sure if something is wrong with what I wrote, of if some admin sql like catexp needs to be run.... -
Oracle 10G R2
Log in as sysdba
SQL> select job,schema_user from dba_jobs;
JOB SCHEMA_USER
22 PERFSTAT
1 SYS
21 REPADMIN
SQL>
SQL> execute dbms_job.remove(22);
BEGIN dbms_job.remove(22); END;
ERROR at line 1:
ORA-23421: job number 22 is not a job in the job queue
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_IJOB", line 529
ORA-06512: at "SYS.DBMS_JOB", line 171
ORA-06512: at line 1
What am I doing wrong?You have to be logged in as the owner of a job to remove it. No other user can do it even dba/sysbda.
Harry -
Hi,
We have imported a schema from 9i user ABC to 10g user ABC using traditonal EXP utility from SYSTEM. There were few jobs in ABC users that have also been imported to the new database.
Now these jobs are actually under ABC user, but they show LOG User = SYSTEM and PRIV User = SYSTEM (may be because they were imported using system user)
Also, I am unable to drop these jobs. They neither get dropped from ABC user not from SYSTEM, not even from SYS user.
Any idea what is happening here ?
Please help...Please provide the output of something similar like the following in your environment.
SQL> r
1* select LOG_USER,PRIV_USER,SCHEMA_USER,job from dba_jobs where job=122
LOG_USER PRIV_USER SCHEMA_USER JOB
TEST TEST TEST2 122
SQL> show user
USER is "TEST2"
SQL> exec dbms_job.broken(122,true);
BEGIN dbms_job.broken(122,true); END;
ERROR at line 1:
ORA-23421: job number 122 is not a job in the job queue
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_IJOB", line 529
ORA-06512: at "SYS.DBMS_JOB", line 245
ORA-06512: at line 1
SQL> conn test/test
Connected.
SQL> exec dbms_job.broken(122,true);
PL/SQL procedure successfully completed. -
STATSPACK 수행방법 ( STATSPACK SNAPSHOT 수집 )
제품 : ORACLE SERVER
작성날짜 : 2002-10-10
STATSPACK 수행방법 ( STATSPACK SNAPSHOT 수집 )
==============================================
PURPOSE
이 자료는 oracle 8.1.6부터 새로이 제공되는 성능 진단도구인 statspack의
수행 방법에 대해 기술한다.
Explanation
1. StatsPack snapshot 수집
snapshot 수집을 위한 가장 단순한 방법은 SQL*Plus에 PERFSTAT 사용자로
login한 후, statspack.snap 프로시져를 수행시키는 것이다.
예.
SQL> connect perfstat/perfstat
SQL> execute statspack.snap;
참고사항 : OPS 환경에서는 데이터를 수집하고자 하는 대상 instance에
접속하여 수행하여야 한다. snapshot은 모든 인스턴스에서 수집되어야만
비교를 해 볼 수 있다. 하나의 인스턴스에서 수집된 snapshot 은 동일한
인스턴스에서 수집된 또 다른 snapshot과 비교가 된다.
성능 분석을 용이하게 하기 위해 initSID.ora 파라미터 파일에서
timed_statistics 값을 true로 지정하는 것이 좋다. timed_statistics
파라미터는 alter system 명령으로, 동적으로 변경 가능한 값이다. 시간
정보는 그 자체로도 중요할 뿐더러 Oracle 기술 지원에 성능관련 문제 분석
을 요청할 때에도 필요하다.
statspack.snap 및 statspack.modify_statspack_parameter 프로시져에는
필요한 파라미터를 지정할 수 있다.
=============================================================================
Parameter Name Valid Values Value Meaning
=============================================================================
i_snap_level 0, 5, 10 5 Snapshot 레벨
i_ucomment Text Blank Snapshot과 함께 저장할 설명문구
i_executions_th Integer >=0 100 SQL 관련 임계치: 실행된 횟수
i_disk_reads_th Integer >=0 1,000 SQL 관련 임계치: 디스크 READ 횟수
i_parse_calls_th Integer >=0 1,000 SQL 관련 임계치: parse call 횟수
i_buffer_gets_th Integer >=0 10,000 SQL 관련 임계치: buffer get 횟수
i_session_id Valid sid 0 (no 세션단위의 성능 정보를 수집하기
from session) 위한 대상 session id
v$session
i_modify_parameter True, False False 파라미터를 앞으로의 snapshot에서도
계속 사용하기 위해 저장할 지 여부
=============================================================================
2. 수집되는 데이터의 양을 지정하는 방법
1) Snapshot 레벨
패키지에 의해 수집되는 데이터 양은 snapshot 레벨에 따라 조정된다.
다시 말해 지정된 레벨은 수집될 데이터의 양을 결정한다.
Level >= 0 일반적인 성능 통계
수집되는 통계 정보:
0 이상의 모든 레벨에서는 일반적인 성능 관련 통계 정보가
수집된다. 여기에는 wait statistics, system event,
system statistics, rollback segment 데이터, row cache, SGA,
background event, session event, lock statistics,
buffer pool statistics, parent latch statistics 등이 포함된다.
Level >= 5 추가적인 데이터 : SQL 문자
이 레벨에서는 하위 레벨에서 수집되는 모든 데이터 이외에도
추가적으로, 자원을 많이 사용하는 SQL 문장과 관련된 성능
정보를 수집한다.
SQL 관련 '임계치'
statspack에 의해 수집되는 SQL 문장은 미리 지정된 다음
조건 중 하나라도 넘을 경우 수집된다.
- SQL 실행 횟수 (기본값 100 )
- SQL 처리시 발생하는 disk read (기본값 1,000 )
- SQL parse call 횟수 (기본값 1,000 )
- SQL 처리시 발생하는 buffer gets (기본값 10,000)
위에 나열된 각각의 임계치는 어떤 SQL 관련 정보를 수집할
것인지를 결정하는 데 사용된다. 위에 언급된 임계치 가운데
하나라도 넘는 SQL 문장과 관련된 정보가 snapshot을 처리
하는 동안 수집된다.
SQL 임계치 레벨 각각은 stats$statspack_parameter 테이블에
저장되어 있거나, snapshot 수집 당시 파라미터에 의해 지정
가능하다.
2) snapshot SQL 임계치
레벨 이외에도 추가적으로 구성 가능한 파라미터가 있다. 이 파라미터들은
SQL 수집 시 사용되는 임계치들로, 임계치를 넘어서는 모든 SQL 문장들이
수집된다.
snapshot level 및 패키지에 의해 사용되는 임계치 관련 정보는
stats$statspack_parameter 테이블에 저장된다.
3) snapshot level과 SQL 관련 임계치 값을 변경하는 방법
snapshot 수집 작업 시 사용되는 기본 파라미터 값은 조정 가능하며,
이 값을 조정함으로써 인스턴스에 미치는 부하를 줄이면서, 원하는
수준의 정보를 수집할 수 있다.
* snapshot을 받아내변서, 새로운 값을 데이터베이스에 저장
( statspack.snap 호출 시, i_modify_parameter 변수 값을 지정 )
SQL> execute statspack.snap -
(i_snap_level=>10, i_modify_parameter=>'true');
i_modify_parameter 를 true로 지정하면, 이 값이 stats$statspack_parameter
테이블에 저장되며; 이 값이 이후 실행되는 snapshot에 사용된다.
i_modify_parameter 값을 false로 지정하거나 생략하면, 해당
snapshot 작업에만 지정된 정보가 사용되며, 이후 작업에는
stats$statspack_parameter 에 지정된 값을 사용하여 작업이 수행된다.
* snapshot 수행을 하지 않고 기본값을 바꾸기 위해서는
statspack.modify_statspack_parameter 프로시져를 사용한다.
예를 들어 snapshot level을 10으로 변경하고, SQL 관련 임계치 가운데
buffer_gets, disk_reads 값을 변경하고자 할 때 다음과 같이 한다.
SQL> execute statspack.modify_statspack_parameter -
(i_snap_level=>10, i_buffer_gets_th=>10000, i_disk_reads_th=>1000);
이 프로시져를 수행시키면, snapshot 수행 없이, 변경 사항이
계속해서 남게 된다.
modify_statspack_parameter 프로시져에 지정 가능한 전체 파라미터의
전체 목록은 snap 프로스져와 동일하다.
4) Session ID 지정
특정 세션과 관련된 정보를 수집하고자 할 경우, StatsPack 호출 시
세션 id 지정이 가능하다. 세션과 관련해서 수집되는 정보에는
세션 통계, 세션 이벤트, lock activity 등이 있다. 기본적으로는
세션 레벨의 통계는 수집하지 않게 되어 있다.
SQL> execute statspack.snap(i_session_id=>3);
3. StatsPack snapshot 수집의 자동화
일중, 주간, 년간 정보를 비교하기 위해서는, 일정 기간 동안 수집된
여러 개의 snapshot 정보가 필요하다. 애플리케이션이나 데이터베이스의
성능 관련 특성을 파악하기 위해서는 최소한 두 개의 snapshot 정보가 필요
하다.
snapshot을 수집하는 최선의 방법은, 일정 주기로 snapshot 수집을
자동화시키는 것이다. 이를 위해 2가지 방법을 사용할 수 있다.
- 데이터베이스가 제공하는 dbms_job 프로시져를 사용하여 snapshot
수집 작업을 스케쥴러에 등록한다.
- OS 시스템 유틸리티( unix의 cron 이나 NT 의 at 명령 )를 사용하여
snapshot을 스케쥴러에 등록한다.
1) DBMS_JOB 패키지를 사용한 StatsPack snapshot 작업의 자동화
오라클 내부적으로 통계정보 수집을 자동화하고자 한다면, dbms_job
패키지를 사용하면 된다. 샘플은 oracle 8.1.6의 경우 $ORACLE_HOME/rdbms/admin/statsuato.sql
( 8.1.7이상은 $ORACLE_HOME/rdbms/admin/spauto.sql) 에 들어 있으며,
매 시간 마다 snapshot을 등록하는 예제이다.
dbms_job을 사용하여 snapshot을 자동화시키기 위해서는, init 파일의
job_queue_processes 파라미터가 0 이상이어야만 한다.
init<SID>.ora 예제:
# Set to enable the job queue process to start. This allows dbms_job
# to schedule automatic statistics collection using STATSPACK
job_queue_processes=1
OPS 환경에서 statsauto.sql 을 사용한다면, statsauto.sql 스크립트는
클러스터 내의 모든 인스턴스에서 한번 씩 수행되도록 하여야 한다.
마찬가지로 job_queue_processes 파라미터 값도 모든 인스턴스에서
0 이상의 값으로 지정되어 있어야 한다.
dbms_job에 대한 자세한 사용방법은 <bulletin:10707> 를 참조한다.
2) OS 시스템 유틸리티를 사용한 StatsPack snapshot 작업의 자동화.
unix의 cron에 등록하는 방법은 <bulletin:10906>을, NT 의 at 명령을 사
용하는 방법은 <bulletin: 11618> 을 참조한다.
4. 통계정보 수집 주기의 변경 방법
통계정보 수집 주기를 변경하기 위해서는 dbms_job.interval 프로시져를
사용한다.
예.
execute dbms_job.interval(1,'SYSDATE+(1/48)');
위에서 SYSDATE+(1/48) 는 통계정보가 1/48 일에 한번씩 ( 매 30분 마다)
수집되도록 지정한 예이다.
job이 즉시 실행되도록 하기 위해서는
execute dbms_job.run(<job number>);
job을 스케쥴러에서 제거하기 위해서는
execute dbms_job.remove(<job number>);
5. STATSPACK의 삭제 및 snapshot 데이타 제거 방법.
1) Statspack 삭제
Statspack 환경 삭제를 위해서는 oracle 8.1.6의 경우는 statsdrp.sql을
oracle 8.1.7 이상의 경우는 spdrop.sql을 수행한다.
cd $ORACLE_HOME/rdbms/admin
SQL> connect / as sysdba
SQL> @statsdrp
2) Snapshot 데이타 제거
불필요한 snapshot 데이타를 제거하기 위해서 oracle 8.1.7부터는
sppurge.sql과 sptrunc.sql을 제공한다.
특정 구간 사이의 snapshot정보를 제거하려면 sppurge.sql을 수행한다.
이 script를 수행하면 삭제할 시작과 끝의 snapshot id를 지정하게 되며 지정
된 구간의 snapshot 데이타가 제거된다.
모든 snapshot 정보를 삭제하려면 sptrunc.sql을 수행한다.
cd $ORACLE_HOME/rdbms/admin
sqlplus perfstat/perfstat
SQL> @sptrunc
Example
none
Reference Documents
<Note:94224.1>
<Note:149121.1>제품 : ORACLE SERVER
작성날짜 : 2002-10-10
STATSPACK 수행방법 ( STATSPACK SNAPSHOT 수집 )
==============================================
PURPOSE
이 자료는 oracle 8.1.6부터 새로이 제공되는 성능 진단도구인 statspack의
수행 방법에 대해 기술한다.
Explanation
1. StatsPack snapshot 수집
snapshot 수집을 위한 가장 단순한 방법은 SQL*Plus에 PERFSTAT 사용자로
login한 후, statspack.snap 프로시져를 수행시키는 것이다.
예.
SQL> connect perfstat/perfstat
SQL> execute statspack.snap;
참고사항 : OPS 환경에서는 데이터를 수집하고자 하는 대상 instance에
접속하여 수행하여야 한다. snapshot은 모든 인스턴스에서 수집되어야만
비교를 해 볼 수 있다. 하나의 인스턴스에서 수집된 snapshot 은 동일한
인스턴스에서 수집된 또 다른 snapshot과 비교가 된다.
성능 분석을 용이하게 하기 위해 initSID.ora 파라미터 파일에서
timed_statistics 값을 true로 지정하는 것이 좋다. timed_statistics
파라미터는 alter system 명령으로, 동적으로 변경 가능한 값이다. 시간
정보는 그 자체로도 중요할 뿐더러 Oracle 기술 지원에 성능관련 문제 분석
을 요청할 때에도 필요하다.
statspack.snap 및 statspack.modify_statspack_parameter 프로시져에는
필요한 파라미터를 지정할 수 있다.
=============================================================================
Parameter Name Valid Values Value Meaning
=============================================================================
i_snap_level 0, 5, 10 5 Snapshot 레벨
i_ucomment Text Blank Snapshot과 함께 저장할 설명문구
i_executions_th Integer >=0 100 SQL 관련 임계치: 실행된 횟수
i_disk_reads_th Integer >=0 1,000 SQL 관련 임계치: 디스크 READ 횟수
i_parse_calls_th Integer >=0 1,000 SQL 관련 임계치: parse call 횟수
i_buffer_gets_th Integer >=0 10,000 SQL 관련 임계치: buffer get 횟수
i_session_id Valid sid 0 (no 세션단위의 성능 정보를 수집하기
from session) 위한 대상 session id
v$session
i_modify_parameter True, False False 파라미터를 앞으로의 snapshot에서도
계속 사용하기 위해 저장할 지 여부
=============================================================================
2. 수집되는 데이터의 양을 지정하는 방법
1) Snapshot 레벨
패키지에 의해 수집되는 데이터 양은 snapshot 레벨에 따라 조정된다.
다시 말해 지정된 레벨은 수집될 데이터의 양을 결정한다.
Level >= 0 일반적인 성능 통계
수집되는 통계 정보:
0 이상의 모든 레벨에서는 일반적인 성능 관련 통계 정보가
수집된다. 여기에는 wait statistics, system event,
system statistics, rollback segment 데이터, row cache, SGA,
background event, session event, lock statistics,
buffer pool statistics, parent latch statistics 등이 포함된다.
Level >= 5 추가적인 데이터 : SQL 문자
이 레벨에서는 하위 레벨에서 수집되는 모든 데이터 이외에도
추가적으로, 자원을 많이 사용하는 SQL 문장과 관련된 성능
정보를 수집한다.
SQL 관련 '임계치'
statspack에 의해 수집되는 SQL 문장은 미리 지정된 다음
조건 중 하나라도 넘을 경우 수집된다.
- SQL 실행 횟수 (기본값 100 )
- SQL 처리시 발생하는 disk read (기본값 1,000 )
- SQL parse call 횟수 (기본값 1,000 )
- SQL 처리시 발생하는 buffer gets (기본값 10,000)
위에 나열된 각각의 임계치는 어떤 SQL 관련 정보를 수집할
것인지를 결정하는 데 사용된다. 위에 언급된 임계치 가운데
하나라도 넘는 SQL 문장과 관련된 정보가 snapshot을 처리
하는 동안 수집된다.
SQL 임계치 레벨 각각은 stats$statspack_parameter 테이블에
저장되어 있거나, snapshot 수집 당시 파라미터에 의해 지정
가능하다.
2) snapshot SQL 임계치
레벨 이외에도 추가적으로 구성 가능한 파라미터가 있다. 이 파라미터들은
SQL 수집 시 사용되는 임계치들로, 임계치를 넘어서는 모든 SQL 문장들이
수집된다.
snapshot level 및 패키지에 의해 사용되는 임계치 관련 정보는
stats$statspack_parameter 테이블에 저장된다.
3) snapshot level과 SQL 관련 임계치 값을 변경하는 방법
snapshot 수집 작업 시 사용되는 기본 파라미터 값은 조정 가능하며,
이 값을 조정함으로써 인스턴스에 미치는 부하를 줄이면서, 원하는
수준의 정보를 수집할 수 있다.
* snapshot을 받아내변서, 새로운 값을 데이터베이스에 저장
( statspack.snap 호출 시, i_modify_parameter 변수 값을 지정 )
SQL> execute statspack.snap -
(i_snap_level=>10, i_modify_parameter=>'true');
i_modify_parameter 를 true로 지정하면, 이 값이 stats$statspack_parameter
테이블에 저장되며; 이 값이 이후 실행되는 snapshot에 사용된다.
i_modify_parameter 값을 false로 지정하거나 생략하면, 해당
snapshot 작업에만 지정된 정보가 사용되며, 이후 작업에는
stats$statspack_parameter 에 지정된 값을 사용하여 작업이 수행된다.
* snapshot 수행을 하지 않고 기본값을 바꾸기 위해서는
statspack.modify_statspack_parameter 프로시져를 사용한다.
예를 들어 snapshot level을 10으로 변경하고, SQL 관련 임계치 가운데
buffer_gets, disk_reads 값을 변경하고자 할 때 다음과 같이 한다.
SQL> execute statspack.modify_statspack_parameter -
(i_snap_level=>10, i_buffer_gets_th=>10000, i_disk_reads_th=>1000);
이 프로시져를 수행시키면, snapshot 수행 없이, 변경 사항이
계속해서 남게 된다.
modify_statspack_parameter 프로시져에 지정 가능한 전체 파라미터의
전체 목록은 snap 프로스져와 동일하다.
4) Session ID 지정
특정 세션과 관련된 정보를 수집하고자 할 경우, StatsPack 호출 시
세션 id 지정이 가능하다. 세션과 관련해서 수집되는 정보에는
세션 통계, 세션 이벤트, lock activity 등이 있다. 기본적으로는
세션 레벨의 통계는 수집하지 않게 되어 있다.
SQL> execute statspack.snap(i_session_id=>3);
3. StatsPack snapshot 수집의 자동화
일중, 주간, 년간 정보를 비교하기 위해서는, 일정 기간 동안 수집된
여러 개의 snapshot 정보가 필요하다. 애플리케이션이나 데이터베이스의
성능 관련 특성을 파악하기 위해서는 최소한 두 개의 snapshot 정보가 필요
하다.
snapshot을 수집하는 최선의 방법은, 일정 주기로 snapshot 수집을
자동화시키는 것이다. 이를 위해 2가지 방법을 사용할 수 있다.
- 데이터베이스가 제공하는 dbms_job 프로시져를 사용하여 snapshot
수집 작업을 스케쥴러에 등록한다.
- OS 시스템 유틸리티( unix의 cron 이나 NT 의 at 명령 )를 사용하여
snapshot을 스케쥴러에 등록한다.
1) DBMS_JOB 패키지를 사용한 StatsPack snapshot 작업의 자동화
오라클 내부적으로 통계정보 수집을 자동화하고자 한다면, dbms_job
패키지를 사용하면 된다. 샘플은 oracle 8.1.6의 경우 $ORACLE_HOME/rdbms/admin/statsuato.sql
( 8.1.7이상은 $ORACLE_HOME/rdbms/admin/spauto.sql) 에 들어 있으며,
매 시간 마다 snapshot을 등록하는 예제이다.
dbms_job을 사용하여 snapshot을 자동화시키기 위해서는, init 파일의
job_queue_processes 파라미터가 0 이상이어야만 한다.
init<SID>.ora 예제:
# Set to enable the job queue process to start. This allows dbms_job
# to schedule automatic statistics collection using STATSPACK
job_queue_processes=1
OPS 환경에서 statsauto.sql 을 사용한다면, statsauto.sql 스크립트는
클러스터 내의 모든 인스턴스에서 한번 씩 수행되도록 하여야 한다.
마찬가지로 job_queue_processes 파라미터 값도 모든 인스턴스에서
0 이상의 값으로 지정되어 있어야 한다.
dbms_job에 대한 자세한 사용방법은 <bulletin:10707> 를 참조한다.
2) OS 시스템 유틸리티를 사용한 StatsPack snapshot 작업의 자동화.
unix의 cron에 등록하는 방법은 <bulletin:10906>을, NT 의 at 명령을 사
용하는 방법은 <bulletin: 11618> 을 참조한다.
4. 통계정보 수집 주기의 변경 방법
통계정보 수집 주기를 변경하기 위해서는 dbms_job.interval 프로시져를
사용한다.
예.
execute dbms_job.interval(1,'SYSDATE+(1/48)');
위에서 SYSDATE+(1/48) 는 통계정보가 1/48 일에 한번씩 ( 매 30분 마다)
수집되도록 지정한 예이다.
job이 즉시 실행되도록 하기 위해서는
execute dbms_job.run(<job number>);
job을 스케쥴러에서 제거하기 위해서는
execute dbms_job.remove(<job number>);
5. STATSPACK의 삭제 및 snapshot 데이타 제거 방법.
1) Statspack 삭제
Statspack 환경 삭제를 위해서는 oracle 8.1.6의 경우는 statsdrp.sql을
oracle 8.1.7 이상의 경우는 spdrop.sql을 수행한다.
cd $ORACLE_HOME/rdbms/admin
SQL> connect / as sysdba
SQL> @statsdrp
2) Snapshot 데이타 제거
불필요한 snapshot 데이타를 제거하기 위해서 oracle 8.1.7부터는
sppurge.sql과 sptrunc.sql을 제공한다.
특정 구간 사이의 snapshot정보를 제거하려면 sppurge.sql을 수행한다.
이 script를 수행하면 삭제할 시작과 끝의 snapshot id를 지정하게 되며 지정
된 구간의 snapshot 데이타가 제거된다.
모든 snapshot 정보를 삭제하려면 sptrunc.sql을 수행한다.
cd $ORACLE_HOME/rdbms/admin
sqlplus perfstat/perfstat
SQL> @sptrunc
Example
none
Reference Documents
<Note:94224.1>
<Note:149121.1> -
when i run the following:
BEGIN
DBMS_DEFER_SYS.SCHEDULE_PURGE (
next_date => SYSDATE,
interval => 'SYSDATE + 1/24',
delay_seconds => 0);
END;
it returns:
ORA-23421: job number 48 is not a job in the job queue
then i run the following:
select job, log_user, what from dba_jobs;
it returns:
JOB LOG_USER
WHAT
1 SYS
wksys.wk_job.invoke(1,1);
2 SYS
wksys.wk_job.invoke(1,2);
47 BAJU
declare rc binary_integer; begin rc := sys.dbms_defer_sys.push(destination=>'MAS
TECH118', stop_on_error=>FALSE, delay_seconds=>0, parallelism=>1); end;
JOB LOG_USER
WHAT
21 SYSMAN
EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS();
48 BAJU
declare rc binary_integer; begin rc := sys.dbms_defer_sys.purge; end;
49 BAJU
dbms_repcat.do_deferred_repcat_admin('"BAJUMASTECHGRP"', FALSE);
plz help me.i am trying to replicate between 2 dbs.
i have successfully ended all these steps but replication is not started.
plz help me.
here is my script:
---Setting PARSKY as mater site in replication environment
1) CREATE USER repadmin IDENTIFIED BY repadmin;
2) EXEC DBMS_REPCAT_ADMIN.GRANT_ADMIN_ANY_SCHEMA (username => 'repadmin');
3) GRANT COMMENT ANY TABLE TO repadmin;
GRANT LOCK ANY TABLE TO repadmin;
GRANT SELECT ANY DICTIONARY TO repadmin;
4) EXEC DBMS_DEFER_SYS.REGISTER_PROPAGATOR (username => 'repadmin');
5) EXEC DBMS_REPCAT_ADMIN.REGISTER_USER_REPGROUP (username => 'repadmin',privilege_type => 'receiver',list_of_gnames => NULL);
6) CONNECT repadmin/repadmin@parsky
EXEC DBMS_DEFER_SYS.SCHEDULE_PURGE (next_date => SYSDATE,interval => 'SYSDATE + 1',delay_seconds => 0);
---Setting SKYDUMMY as mater site in replication environment
1) CONNECT sys/sys@skydummy as sysdba
CREATE USER repadmin IDENTIFIED BY repadmin;
2) EXEC DBMS_REPCAT_ADMIN.GRANT_ADMIN_ANY_SCHEMA (username => 'repadmin');
3) GRANT COMMENT ANY TABLE TO repadmin;
GRANT LOCK ANY TABLE TO repadmin;
GRANT SELECT ANY DICTIONARY TO repadmin;
4) EXEC DBMS_DEFER_SYS.REGISTER_PROPAGATOR (username => 'repadmin');
5) EXEC DBMS_REPCAT_ADMIN.REGISTER_USER_REPGROUP (username => 'repadmin',privilege_type => 'receiver',list_of_gnames => NULL);
6) CONNECT repadmin/repadmin@skydummy
EXEC DBMS_DEFER_SYS.SCHEDULE_PURGE (next_date => SYSDATE,interval => 'SYSDATE + 1',delay_seconds => 0);
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Creating Scheduled Links Between the Master Sites
---fOR PARSKY SITE
1) CONNECT sys@parsky as sysdba
CREATE PUBLIC DATABASE LINK SKYDUMMY USING 'SKYDUMMY';
2) CREATE DATABASE LINK SKYDUMMY CONNECT TO repadmin IDENTIFIED BY repadmin;
---fOR SKYDUMMY SITE
1) CONNECT sys/SYS@skyDUMMY as sysdba
CREATE PUBLIC DATABASE LINK PARSKY USING 'PARSKY';
2) CREATE DATABASE LINK PARSKY CONNECT TO repadmin IDENTIFIED BY repadmin;
----Define a schedule for each database link to create scheduled links.
---For PARSKY site
1) CONNECT repadmin/repadmin@parsky
EXEC DBMS_DEFER_SYS.SCHEDULE_PUSH (destination => 'SKYDUMMY',interval => 'sysdate+1/24/60',next_date => sysdate+1/24/60,stop_on_error => FALSE,parallelism => 1,delay_seconds => 1200);
2) CONNECT repadmin/repadmin@skydummy
EXEC DBMS_DEFER_SYS.SCHEDULE_PUSH (destination => 'PARSKY',interval => 'sysdate+1/24/60',next_date => sysdate+1/24/60,stop_on_error => FALSE,parallelism => 1,delay_seconds => 1200);
Chapter 2
Creating a Master Group
--- For parsky
1) CONNECT repadmin/repadmin@parsky
EXEC DBMS_REPCAT.CREATE_MASTER_REPGROUP (gname => 'hr_repg');
2) EXEC DBMS_REPCAT.CREATE_MASTER_REPOBJECT (gname => 'hr_repg',type => 'TABLE',oname => 'countries',sname => 'hr',use_existing_object => TRUE,copy_rows => TRUE);
3) Add additional master sites.
a) exec DBMS_REPCAT.ADD_MASTER_DATABASE (gname => 'hr_repg',master => 'skydummy',use_existing_objects => TRUE,copy_rows => TRUE,propagation_mode => 'ASYNCHRONOUS');
4) If conflicts are possible, then configure conflict resolution methods.
a) exec DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT (sname => 'hr',oname => 'countries',type => 'TABLE',min_communication => TRUE);
5) Resume replication.
DBMS_REPCAT.RESUME_MASTER_ACTIVITY (gname => 'hr_repg'); -
Autosys job scheduling on particular instance
I have to run one procedure which WARMUPs the memory and keep the data in BUFFER POOL as we set the BUFFER_POOL for few tables as KEEP. But I want to make sure my proc runs on both the nodes/instance of my database.
Can you please suggest if this is possible through autosys jobs or not. And if yes then how?
I also tried using the dbms_job but that is operating on only one instance and for othe instance it throws the error:
ERROR at line 1:
ORA-23421: job number 10855 is not a job in the job queue
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_IJOB", line 599
ORA-06512: at "SYS.DBMS_JOB", line 261
ORA-06512: at line 1
Kindly adviceuser12841217 wrote:
I have to run one procedure which WARMUPs the memory and keep the data in BUFFER POOL as we set the BUFFER_POOL for few tables as KEEP. But I want to make sure my proc runs on both the nodes/instance of my database.
Can you please suggest if this is possible through autosys jobs or not. And if yes then how?
I also tried using the dbms_job but that is operating on only one instance and for othe instance it throws the error:
ERROR at line 1:
ORA-23421: job number 10855 is not a job in the job queue
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_IJOB", line 599
ORA-06512: at "SYS.DBMS_JOB", line 261
ORA-06512: at line 1
Kindly adviceI'd highly suggest not bothering. Oracle will retain that which it needs in memory, there shouldn't be a need for you to "warm up" anything.
Maybe you are looking for
-
Built in webcam doesn't work in Ubuntu
Hi everyone I've just installed a clean Ubuntu 14.04 on my MSI CR620 notebook. So, my built-in webcam is not recognized by Skype (in it's video settings it says "device not found"). Hitting Fn+F6 doesn't affect anything. Any helpful advice would be h
-
2013LinuxC​W14.zip corrupt, will not unzip on Linux
Hi folks, the LabView Compile Worker 2013 for Linux zip file ( 2013LinuxCW14.zip) appears to be corrupt. We also tried to unzip it on OS X and Windows machines with the same issues. We had the same problem with the 2012 compile worker zip file and NI
-
How to use a Webservice (deployableproxy) within a portal component?
hi, i need to know how to use a webservice using a deployable proxy within a portal component? i've created the proxies and they work (with servlets). i know how to use them in servletes (context lookup, jndi mapping, application references) but i ca
-
How do I open CS4 files in CS5??
Need an answer ASAP! I have old files that I worked on in CS4 and I need to go back and make revisions and I only have CS5 I try to open it and I get "After Effects Warning: This file doesn't exist"
-
How do you make MP3 audio files?
I'm running for public office, and a local newspaper invited candidates to submit statements, along with MP3 audio files for display on its website. So how does one make an MP3 audio file? Is this something I can do with my MacBook Pro and Leopard al