Monday, 16 June 2014

Resolving ORACLE Database Errors - ORA-28000,ORA-28001,ORA-28002,XS$NULL

 

ORACLE ERROR:ORA-28000: The account is locked

 

After installation of Oracle10g/11g, there was a problem..couldnt login using SQL+. None of the accounts(scott/tiger) worked . At last a quick web search gave the solution . Here is what it is:
From your command prompt, type 
sqlplus "/ as sysdba"

Once logged in as SYSDBA, you need to unlock the SCOTT account 

SQL> alter user scott account unlock;

SQL> grant connect, resource to scott;


ORA-28001: the password has expired


Applies to:

Oracle Database Software Std & Enterprise Edition - Version: 11.1.1.1.0 and later   [Release: 11gR1 and later ]Information in this document applies to any platform.

Reason:

In Oracle Database, A remote DBAface this because password have reached 180 Default limit for Password life time. The life of a password is defined as 180 days by default. DBA has to change this limit to unlimited to solve this and to avid this in future. Before getting this error DBA will also show ORA-28002: the password will expire within n days 


So lets deal with the issue  ORA-28001

The users password were expired and in their grace period.Here is what it looked like:


SQL> select username,account_status,expiry_date from dba_users;

USERNAME                      ACCOUNT_STATUS               EXPIRY_DATE
------------------------------ ------------------------   ------------
SELFLOAD                      OPEN
PROD                          OPEN
TECHNO                        EXPIRED(GRACE)                 11-JAN-14
SCOTT                         EXPIRED & LOCKED               08-JUL-14
ORACLE_OCM                    EXPIRED & LOCKED               15-AUG-09
XS$NULL                       EXPIRED & LOCKED               15-AUG-13
MDDATA                        EXPIRED & LOCKED               15-AUG-13
DIP                           EXPIRED & LOCKED               15-AUG-09
APEX_PUBLIC_USER              EXPIRED & LOCKED               15-AUG-09
SPATIAL_CSW_ADMIN_USR         LOCKED                         15-AUG-09


So here is what I did:-


connect to sql like- sqlplus "/ as sysdba"

SQL> select password from sys.user$ where name='TECHNO';

PASSWORD
------------------------------
7A0F2B316C212D67

This gave me the hashed password for the user TECHNO

Then again set the same password for user TECHNO:

SYS> alter user TECHNO identified by values '7A0F2B316C212D67';

Now the account is open again and not expired or in grace period:

USERNAME                      ACCOUNT_STATUS               EXPIRY_DATE
----------------------     -------------------           --------------
SELFLOAD                      OPEN
PROD                          OPEN
TECHNO                        OPEN                           11-JAN-14
SCOTT                         EXPIRED & LOCKED               08-JUL-14
ORACLE_OCM                    EXPIRED & LOCKED               15-AUG-09
XS$NULL                       EXPIRED & LOCKED               15-AUG-13
MDDATA                        EXPIRED & LOCKED               15-AUG-13
DIP                           EXPIRED & LOCKED               15-AUG-09
APEX_PUBLIC_USER              EXPIRED & LOCKED               15-AUG-09
SPATIAL_CSW_ADMIN_USR         LOCKED                         15-AUG-09




The above option may not work completely on the case "EXPIRED & LOCKED" it may remain LOCKED although it will no longer appear EXPIRED like:-


USERNAME                      ACCOUNT_STATUS               EXPIRY_DATE
----------------------     -------------------           --------------
SCOTT                           LOCKED                       08-JUL-14


So in that case unlock the user as illustrated below:-


connect to sql as- sqlplus "/ as sysdba"

Once logged in as SYSDBA, you need to unlock the SCOTT account 

SQL> alter user scott account unlock;

SQL> grant connect, resource to scott;

The other way to to open the expired password is to try to connect the user using the command prompt, it will ask to you to change the password as follows,  It will ask you for the password provide the password,account will be open.

SQL> conn techno/password
ERROR:
ORA-28001: the password has expired

Changing password for techno
New password:
Retype new password:
Password changed
Connected.


 

XS$NULL

Although by above methods one can unlock the users but the following user XS$NULL  remains "EXPIRED & LOCKED"

Explanation for the same:-

Oracle introduced a new user in version 11g called XS$NULL. It is for Oracle’s internal use only and you should leave it alone. For this reason it is locked and expired when it is created:

SQL> select account_status from dba_users

  2  where username = 'XS$NULL';

ACCOUNT_STATUS
--------------------------------
EXPIRED & LOCKED

SQL>

You are advised not to alter this account in any way, even if an auditor asks you to. Oracle does not let you change its password:

SQL> conn / as sysdba

Connected.

SQL> alter user xs$null identified by new_pwd
  2  /
alter user xs$null identified by new_pwd
                                 *
ERROR at line 1:
ORA-01031: insufficient privileges

SQL>

Although you can do so with the password command:

SQL> select password from sys.user$
  2  where name = 'XS$NULL';

PASSWORD
------------------------------
DC4FCC8CB69A6733

SQL> password xs$null
Changing password for xs$null
New password:
Retype new password:
Password changed


SQL> select password from sys.user$where name = 'XS$NULL';

PASSWORD
------------------------------
C17AE3B0A14EA63F

SQL>

This is because of bug 12822989 and you must not do this.




ERROR: ORA-28002: the password will expire within 6 days. 
Lets see what we can do about resolving this issue.
You could simply just change the users password. In an ideal and secure world, this is exactly what you would do. Though this may not be practical, there may be a whole host of reasons for postponing the change.
In Oracle 11g, users are assigned to a profile, the default profile is named “DEFAULT”. This default profile comes configured with a maximum password lifetime of a 180 days.
[box type="info"] Just note that this document’s steps have been performed on Oracle 11g Release 11.2.0.3.0 running on Red Hat Enterprise Linux 6.3. The SQL syntax provided “should” work on all Oracle 11g platforms.[/box]

Step 1: Identify the Users Profile

Log into Oracle 11g using SQL*Plus tool as sysdba


Step 1: Identify the Users Profile
Log into Oracle 11g using SQL*Plus tool as sysdba
[oracle@oracle1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Nov 20 12:18:08 2012
Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production

SQL>
Lets confirm that the user is running the default profile. Note you must capitalize the username.

SQL> SELECT profile FROM dba_users WHERE username = 'USER1';

PROFILE
------------------------------
DEFAULT

we can change the password ,

As you can see, the user has the profile of “DEFAULT” configured.

Step 2: View the Profile settings
Lets examine the settings of the profile


SQL> select resource_name,resource_type, limit from dba_profiles where profile='DEFAULT';
 
RESOURCE_NAME                                                           RESOURCE LIMIT
-------------------------------- --------                 ----------------------------------------
COMPOSITE_LIMIT                                                        KERNEL   UNLIMITED
SESSIONS_PER_USER                                                     KERNEL   UNLIMITED
CPU_PER_SESSION                                                          KERNEL   UNLIMITED
CPU_PER_CALL                                                              KERNEL   UNLIMITED
LOGICAL_READS_PER_SESSION                                        KERNEL   UNLIMITED
LOGICAL_READS_PER_CALL                                             KERNEL   UNLIMITED
IDLE_TIME                                                                    KERNEL   UNLIMITED
CONNECT_TIME                                                              KERNEL   UNLIMITED
PRIVATE_SGA                                                                  KERNEL   UNLIMITED
FAILED_LOGIN_ATTEMPTS                                           PASSWORD 10
PASSWORD_LIFE_TIME                                                PASSWORD 180
PASSWORD_REUSE_TIME                                          PASSWORD UNLIMITED
PASSWORD_REUSE_MAX                                         PASSWORD UNLIMITED
PASSWORD_VERIFY_FUNCTION                              PASSWORD NULL
PASSWORD_LOCK_TIME                                               PASSWORD 1
PASSWORD_GRACE_TIME                                           PASSWORD 7
 
16 rows selected 


As you can see the PASSWORD_LIFE_TIME is to 180 days, you may configure this however you want.

Step 3: Set PASSWORD_LIFE_TIME
In this example, we’re going to make the password life unlimited so that it never expires. This may not be the wisest thing to do in a production environment. However there may be circumstances that require a password change at a later date.

To make this change we simply need to run the following command:

SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

Profile altered.
Step 4: Re-Enter the Password
You may notice that even after setting the password expiry to unlimited you are still getting the “ERROR: ORA-28002: the password will expire” message. I’m guessing this is due to additional processes that Oracle does in the background for checking password age etc. So this forces us to “reset” the password to it’s current value to remove the error.

This is done via the following SQL

SQL> alter user USER1 identified by "password";

User altered.
Just note that the password must be double quoted and not single quoted.

…and that’s it, you should no longer receive the “ORA-28002: the password will expire” message for USER1 when logging in.

[box type="warning"] Just note that having never expiring passwords probably isn’t the best password policy to maintain. Oracle’s password expiration setting is a great way to remind users and admin’s to change their passwords regularly.[/box]

In the End:-

It should serve as a warning that when the account has a status of EXPIRED & LOCKED after initial database creation it is much different than if that account is altered to that status after an account has been assigned a password and unlocked. Some tools, such as SQL*Plus will allow the user the chance to change the password if the old password is properly supplied. 

For example:

1.  We can easily expire the password for the ANONYMOUS account

SQL> ALTER USER anonymous PASSWORD EXPIRE;
User altered.
And the status would clearly be:
USERNAME              ACCOUNT_STATUS    LOCK_DATE EXPIRY_DA
--------------------- ----------------- --------- ---------
ANONYMOUS             EXPIRED                     11-SEP-09

2.  The ANONYMOUS account would be prompted for a password and allowed to connect after entering a new password:

SQL> connect anonymous/abc
ERROR:
ORA-28001: the password has expired
 
Changing password for anonymous
New password: xyz
Retype new password: xyz
Password changed
Connected.
By contrast, if you really wanted to lock out a user from connecting in the future, regardless of password expiration, you should LOCK the account. For example:


3.  We can easily lock the ANONYMOUS account
SQL> ALTER USER anonymous ACCOUNT LOCK;
User altered.
And the status would clearly be:
USERNAME              ACCOUNT_STATUS    LOCK_DATE EXPIRY_DA
--------------------- ----------------- --------- ---------
ANONYMOUS             LOCKED            11-SEP-09 10-MAR-10

4.  The ANONYMOUS account is totally locked out and unable to connect:
SQL> connect anonymous/abc
ERROR:

ORA-28000: the account is locked

Expiring and locking user accounts are one of the first steps to securing who can connect to an Oracle database. The expiration of account passwords is not an effective lock-out mechanism but should instead be used to encourage users to just change their passwords over time. Locking an account though has the effect of truly locking out an account so no one can use it to connect to the database. If you need to disable an account this is the preferred method other than dropping it. Just be warned that expiring an account leaves the prior password intact. Under this condition if you were to lock the account and someone came up behind your work and unlocked the account, the user could still log in by changing the password. It is therefore suggested to alter the password before expiring and locking. That way even if the lock were removed the user would have no way of ever connecting again.



Thank You.










Saturday, 24 May 2014

Oracle Adapters

Introduction to Oracle JCA Adapters


Adapters support a robust, light weight, highly scalable, and standards-based integration framework, which enables disparate applications to communicate with each other. For example, adapters enable you to integrate packaged applications, legacy applications, databases, and Web services. Using Oracle JCA Adapters, you can ensure interoperability by integrating applications that are heterogeneous, provided by different vendors, based on different technologies, and run on different platforms.

Features of Oracle JCA Adapters:-

Oracle JCA Adapters provide the following benefits:
• Provide a connectivity platform for integrating complex business processes: Adapters integrate mainframe and legacy applications with enterprise resource planning (ERP), customer relationship management (CRM), databases, and messaging systems. Oracle provides adapters to connect various packaged applications, such as SAP and Siebel, and databases. In addition, adapters integrate middleware messaging systems, such as MQSeries and Oracle Advanced Queuing, and legacy applications, such as CICS and Tuxedo, to provide a complete solution.
• Support open standards: Adapters are based on a set of standards such as J2EE Connector Architecture (JCA) version 1.5, Extensible Markup Language (XML), and Web Service Definition Language (WSDL). The support for standards reduces the learning curve of a user and eliminates the dependency of users on a single vendor.
• Service Component Architecture (SCA) assembly model: Provides the service details and their interdependencies to form composite applications. SCA enables you to represent business logic as reusable service components that can be easily integrated into any SCA-compliant application. The resulting application is known as an SOA composite application. The specification for the SCA standard is maintained by the Organization for the Advancement of Structured Information Standards (OASIS).
• Implement a Service-Oriented Architecture (SOA): The support for open standards enables adapters to implement an SOA, which facilitates loose coupling, flexibility, and extensibility.
• Use native APIs: Adapters support multiple ways of interfacing with the back-end system and provide various deployment options. Using native APIs, adapters communicate with the back-end application and also translate the native data to standard XML, which is provided to the client.
• Model data: Adapters convert native APIs to standard XML and back, based on the adapter metadata configured during design time. Adapter configurations are defined during design time, which will be used by run-time components.
• Facilitate real-time and bidirectional connectivity: Adapters offer bidirectional communication with various back-end systems. This includes sending requests to back-end systems and receiving a response. Adapters also support the real-time event notification service. This service notifies about the back-end events associated with successful back-end transactions for creating, deleting, and updating back-end data. This two-way connectivity ensures faster, flexible, efficient integration, and reduces the cost of integration.
• Maximize availability: Oracle JCA Adapters are based on the J2CA 1.5 specification. Adapters can, therefore, fully leverage the scalability and high availability of the underlying Oracle Application Server platform.
For more information, see Oracle Fusion Middleware Programming Resource Adapters for Oracle WebLogic Server.
In addition, adapters can be deployed on the JBoss and WebSphere platforms.
• Provide easy-to-use design-time tools: Adapters use design-time tools that provide a graphical user interface (GUI) to configure and administer adapters for fast implementation and deployment. In addition, the tools let you to browse, download, and configure back-end schemas.
• Support seamless integration with Oracle Application Server components: Adapters integrate with Oracle Fusion Middleware. Adapters integrate with the JCA Binding Component of the Oracle Fusion Middleware platform, thereby seamlessly integrating with other service engines and binding components.

Types of Oracle JCA Adapters

Oracle JCA Adapters include:-

• Oracle Technology Adapters
• Legacy Adapters
• Packaged-Application Adapters
• Oracle Adapter for Oracle Applications




Oracle Technology Adapters

Oracle technology adapters integrate Oracle Application Server and Oracle Fusion Middleware components such as Oracle BPEL Process Manager (Oracle BPEL PM) or Oracle Mediator components to file systems, FTP servers, database queues (advanced queues, or AQ), Java Message Services (JMS), database tables, and message queues (MQ Series).
These adapters include:
·         Oracle JCA Adapter for Files/FTP
·         Oracle JCA Adapter for Sockets
·         Oracle JCA Adapter for Oracle Streams Advanced Queuing (Oracle JCA Adapter for AQ)
·         Oracle JCA Adapter for JMS
·         Oracle JCA Adapter for Database
·         Oracle JCA Adapter for MQ Series
Oracle technology adapters are installed as part of Oracle Fusion Middleware.


Legacy Adapters

Legacy adapters integrate Oracle Application Server with legacy and mainframe applications using legacy communication protocols.
These adapters include:
·         OracleAS Adapter for Tuxedo
·         OracleAS Adapter for CICS
·         OracleAS Adapter for VSAM
·         OracleAS Adapter for IMS/TM
·         OracleAS Adapter for IMS/DB

Packaged-Application Adapters

Packaged-application adapters integrate Oracle Application Server with various packaged applications, such as SAP and Siebel.
These adapters include:
·         OracleAS Adapter for PeopleSoft
·         OracleAS Adapter for SAP R/3
·         OracleAS Adapter for Siebel
·         OracleAS Adapter for J.D. Edwards





Oracle Adapter for Oracle Applications

Oracle Applications are built on a unified information architecture that consolidates data from Oracle and non-Oracle applications and enables a consistent definition of customers, suppliers, partners, and employees across the entire enterprise. This results in a suite of applications that can give you information, such as current performance metrics, financial ratios, profit and loss summaries. To connect Oracle Applications to non-Oracle applications, you use Oracle Adapter for Oracle Applications.
“Adapter for Oracle Applications is also informally known as Oracle E-Business Suite Adapter”
Oracle Adapter for Oracle Applications provides comprehensive, bidirectional, multimodal, synchronous, and asynchronous connectivity to Oracle Applications.


Monday, 23 December 2013

Metadata Error : Error while opening project

While trying to open some sample soa project in Jdeveloper,Icame across with following errors as listed below :- 

Error: oracle.fabric.common.FabricException: oracle.mds.config.MDSConfigurationException: MDS-01330: unable to load MDS configuration document  
  
MDS-01329: unable to load element "persistence-config"

MDS-01370: MetadataStore configuration for metadata-store-usage "mstore-usage_1" is invalid.    

MDS-00503: The metadata path "C:\Oracle\Middleware\jdeveloper\integration" does not contain any valid directories.

: MDS-01330: unable to load MDS configuration document  
  
MDS-01329: unable to load element "persistence-config"

MDS-01370: MetadataStore configuration for metadata-store-usage "mstore-usage_1" is invalid. 
   
MDS-00503: The metadata path "C:\Oracle\Middleware\jdeveloper\integration" does not contain any valid directories.

: oracle.mds.config.MDSConfigurationException: MDS-01330: unable to load MDS configuration document    

MDS-01329: unable to load element "persistence-config"

MDS-01370: MetadataStore configuration for metadata-store-usage "mstore-usage_1" is invalid.    

MDS-00503: The metadata path "C:\Oracle\Middleware\jdeveloper\integration" does not contain any valid directories.

: MDS-01330: unable to load MDS configuration document 
   
MDS-01329: unable to load element "persistence-config"

MDS-01370: MetadataStore configuration for metadata-store-usage "mstore-usage_1" is invalid.    

MDS-00503: The metadata path "C:\Oracle\Middleware\jdeveloper\integration" does not contain any valid directories.
--------------------------------------------------------------------------------------------




FIX: solution - open the .adf\META-INF in your project and give th ecorrect path of j developer integration folder 
eg in my case it was   : C:\Oracle\Middleware\Jdeveloper\jdeveloper\integration

It works in my case hope it also help you out.

Wednesday, 11 December 2013

11g SOA : How to set Title for Composite


When you have thousands of transactions processed through SOA composite, it becomes almost impossible to find/audit any particular instance through EM console unless you have a way to query particular transaction through its business key.
One solution for this is to set  business key of transaction as title to the composite. Once this is done, you can use in built search functionality available in instances tab in em console.
In 11g, you can set the composite title without adding any Java embedded activity to the process definition.
Add an assign activity and set the property .
In From section,
1.select Type as “expression”
2. look for function in “Mediator Extension Functions” called setCompositeInstanceTitle
med:setCompositeInstanceTitle(concat("",<xpath for your variable>))
Note : For this to work, make sure you pass string to this function. You can either use string() or concatenate with “” to make it string as shown above.
In To section
1. Select Type as “property”.
2. select/enter : tracking.compositeInstanceTitle
Note : This property is not visible in available properties list, but will work once you add it.
More on 11g..
http://soadiscovery.blogspot.com/2011/05/oracle-fusion-middleware-patch-set-4ps4.html
http://soadiscovery.blogspot.com/2011/04/timeout-for-webservice-in-11g.html
http://soadiscovery.blogspot.com/2011/04/soa-11g-configuring-transaction-timeout.html

Creating an MDS connection through JDeveloper 11g


3. Choose Database Connection:

 4. Enter your database information to your MDS as follows:
5. Go back and create a new connection, this time, choose SOA-MDS Connection:
 6. Choose "DB Based MDS", choose the connection created in the previous step, and select the "soa-infra" MDS partition:

Now, under the Resource Palette, you will notice the SOA-MDS connection under IDE Connections:
You can now reference artifacts in the MDS through your code.

Referencing DVMs (through attributes or XSL)
dvm:lookupValue('oramds:/apps/AIAMetaData/dvm/hello.dvm','Name','Jack','ID','')

Fault bindings in composite.xml
<property name="oracle.composite.faultBindingFile">oramds:/apps/AIAMetaData/faultPolicies/fault-bindings.xml</property>

Schema or WSDL import
<xsd:import namespace="http://xmlns.oracle.com/bpel" schemaLocation="oramds:/apps/AIAMetaData/AIAComponents/hello.xsd"/>

How to setup MetaData Store (MDS) for Weblogic 11g in Jdeveloper


SOA Suite 11g has a provision for sharing SOA artifacts through MDS – Meta Data Store. This facilitates greater re-use of SOA artifacts such as XML Schemas, EBMs, WSDLs, Fault Policies, Rule repositories and Service Data Objects (SDOs) among others. MDS can be file-based or database-based. Here are the steps to create and use Databased and file-based MDS in JDeveloper.
MDS is created under <jdeveloper-home>/integration/seed directory. Default folder “soa” is used to store common system soa artifacts. All custom artifacts are supposed to be stored under a folder called “apps”, since this folder already exists in server.
Create directory structure under apps folder. In my case, I’ve created folder structure ../apps/cosdeaia/ApplicationConnectorServiceLibrary to store XML schema files. This ideally should match your schema structure.
1. First you go to your local 11g Jdeveloper installation folder. In my case it isC:\JDEV_HOME11.1.1.3\jdeveloper\integration\ folder (if you have already applied third party plugin patch provided by oracle then you will see seed folder by default with all previous configuration done). If not create a seed folder under integration folder.
2. Now create folder with name apps under seed (remember to create folder with name apps else you might face issue this oracle documents say i didn’t try out).
3. Under apps you can create your folder structure to place all your XSD, WSDL files.
4. We can create a SOA_MDS connection in Jdeveloper as below -
New  Connections — > SOA-MDS Connection

5. The SOA-MDS connection can be created in two ways. One is File Based MDS and other is Data Based MDS.
MDS Setup
6. In Create SOA_MDS Connection window, select File Based MDS as Connection              Type for file based MDS connection, we will point to the local folder in our system               where all the WSDL and XSD files are placed as shown below. So when we use the wsdl         and xsd files in the  project, they will be referred from the local system.
MDS Setup
7. Click OK. Now the File Based MDS connection is created.
8. Lets see how to create DB based MDS connection. In Create SOA_MDS Connection window, select DB Based MDS as Connection Type for file based MDS connection.
9. For DB Based MDS connection, we should have created all the schema for the weblogic in the database by running the Repository Creation Utility (RCU) wizard. After RCU execution, the DEV_MDS schema will get created in the database. We need to use the DEV_MDS schema connection and soa-infra as MDS Partition while creating the DB Based MDS connection as shown in the above screen shot.
10. Click OK. Now the DB Based MDS connection is created.
11. So when we use the wsdl and xsd files in the project, they will be referred from the local system. But when we deploy the application into Weblogic server, the wsdl and xsd file references will be missing. To avoid this we need to use an Ant script and import all the WSDL and XSD files into Weblogic server.
12. You use common sca tool (common-sca-tools.xml) to do it and use Ant target nameimportCommonServiceArtifactsIntoMds from class files provided by oracle (MDSImportTask).
13. So whenever we made modifications or additions to the WSDL or XSD files, we need to update the Weblogic server. While update, by using an Ant script first delete all the files from Weblogic server and execute re-import Ant script the latest files into Weblogic server.
14. After Import into Weblogic server, you can use the wsdl and xsd files in your project by referring to the Weblogic server through SOA-MDS (Data Based MDS) connection type. But never Copy these files into your project while referring from Weblogic server. By copying this creates a mess in run time. For example while working you do some modifications in the local WSDL and XSD files and you will forgot to update these changes in to Weblogic server.
15. Whenever we refer the WSDL or XSD files from SOA-MDS (Data Based MDS) connection type, the location URL looks like oramds:/apps/cosdeaia/… (In my case the cosdeaia folder contains all my files…)
16. The new connection appears under the “Resource Pallette” window on right side of the Jdeveloper as shown below
Now you have created the MDS connection in Jdeveloper. You can use in in your SOA Composites.