29 Mart 2016 Salı

Custom tasks Oracle BPM 12c: example of restricting the list of users for operation "Delegate"


By default, the task in Oracle BPM can reassign or delegate to any user, role and group. But you can limit the list by creating a class BPM-project (in terms of JDeveloper), which implements the interface oracle.bpel.services.workflow.task.IRestrictedAssignmentCallback.

Consider an example where you want to restrict users to a list of "delegation" of the operation as follows:
If the contractor is a task group or role, the delegate can only be users of the composition of the group or role;
If the problem is the executor of the user, it can not be delegated (empty list of available users to delegate).
Example code:


Error creating a default domain in JDeveloper 12.2.1 on the Windows 10 platform


Error:
 wlst>
 wlst> Initializing WebLogic Scripting Tool (WLST) ...
 wlst>
 wlst> Welcome to WebLogic Server Administration Scripting Shell
 wlst>
 wlst> Type help () for help on available commands
 wlst>
 wlst> Failed to get environment, environ will be empty: (0, u'Failed to execute command ([\ 'sh \', \ '- c \', \ 'env \']): java.io.IOException: Can not run program "sh": CreateProcess error = 2, \ u041D \ u0435 \ u0443 \ u0434 \ u0430 \ u0435 \ u0442 \ u0441 \ u044F \ u043D \ u0430 \ u0439 \ u0442 \ u0438 \ u0443 \ u043A \ u0430 \ u0437 \ u0430 \ u043D \ u043D \ u044B \ u0439 \ u0444 \ u0430 \ u0439 \ u043B ')
 wlst> Error: ADRS_DOMAIN_PASSWORD environment variable not set.
 wlst>
 wlst>
 wlst> Exiting WebLogic Scripting Tool.
 wlst>

Solutions:
1. Change the archive
% JDEVELOPER_HOME% / wlserver / common / wlst / modules / jython-modules.jar next file \ Lib \ javashell.py (added in red):
   ...
   os = str (os or sys.registry.getProperty ( "python.os") or \
         System.getProperty ( "os.name"))
   _osTypeMap = (
     ( "Nt", ( 'nt', 'Windows NT', 'Windows NT 4.0', 'WindowsNT',
          'Windows 2000', 'Windows 2003', 'Windows XP', 'Windows CE',
          'Windows Vista', 'Windows Server 2008' 'the Windows 7', 'the Windows 8'
          'The Windows 10', 'Windows Server 2012'))
     ( "Dos", ( 'dos', 'Windows 95', 'Windows 98', 'Windows ME')),
     ( "Mac", ( 'mac', 'MacOS', 'Darwin')),
     ( "None", ( 'None',)),
     )
   ...

2. Open a service request (SR) to support and receive the official patch.

DBMS_LDAP Example. Sample code to work with Service DBMS_LDAP


How to write a simple code that works with LDAP-directory using DBMS_LDAP package
Perhaps you have had to deal with a situation where we must directly from the Oracle database to ask for data that resides in the LDAP-directory.
For this purpose there exists a wonderful standard DBMS_LDAP package.
Below is a sample code where we want to get the cn user, knowing his DN.

Declare
  ldap_session DBMS_LDAP.session: = null;
  ErrorMsg VARCHAR2 (4000);
- The attribute value
  my_attr_value varchar2 (256);
  entry_dn varchar2 (256);
  my_vals DBMS_LDAP.STRING_COLLECTION;
  my_ber_elmt DBMS_LDAP.ber_element;
  my_attrs DBMS_LDAP.STRING_COLLECTION;
  my_attr_name varchar2 (256);
  my_message DBMS_LDAP.message;
  my_entry DBMS_LDAP.message;
  ret_val PLS_INTEGER: = - 1;
- Distinguished name user
  userDN varchar2 (2000): = 'uid = iivanov, ou = People, dc = maxcrc, dc = com';
BEGIN
  my_attrs (1): = 'cn';

- The creation of LDAP session handle (server address, port)
  ldap_session: = DBMS_LDAP.init ( 'asusnote', '389');

- Admin, password
  ret_val: = DBMS_LDAP.simple_bind_s (ldap_session, 'cn = Manager, dc = maxcrc, dc = com', 'secret');
 
- Looking user
  ret_val: = DBMS_LDAP.search_s (ldap_session,
                                userDN,
                                DBMS_LDAP.SCOPE_BASE,
                                'Objectclass = inetorgperson',
                                my_attrs,
                                0
                                my_message);

  dbms_output.put_line ( 'Debug :: ret_Val expected is 0, found =' || ret_val);
  dbms_output.put_line ( '! Debug :: if ret_Val = 0 then ckeck dbms_ldap package for error code');

- To get an attribute value from the search results
  my_entry: = DBMS_LDAP.first_entry (ldap_session, my_message);
  my_attr_name: = DBMS_LDAP.first_attribute (ldap_session, my_entry, my_ber_elmt);
  my_vals: = DBMS_LDAP.get_values ​​(ldap_session, my_entry, my_attr_name);
  my_attr_value: = my_vals (0);

  dbms_output.put_line ( 'Debug ::' || my_attr_name || '=' || my_attr_value);

EXCEPTION
 WHEN others THEN
   ErrorMsg: = SQLERRM;
   dbms_output.put_line ( 'Error ::' || ErrorMsg);
END;

Oracle Database. How to recover a lost Oracle database data file (ORA-01157, ORA-01110, ORA-27041, OSD-04002)

Restore Oracle database data files in the event of loss
If you find such an error in the console or alert.log your database:
Errors in file D: \ APP \ ASUS \ diag \ rdbms \ orcl \ orcl \ trace \ orcl_dbw0_8104.trc:
ORA-01157: can not identify / lock data file 10 - see DBWR trace file
ORA-01110: data file 10: 'D: \ APP \ ASUS \ ORADATA \ ORCL \ DEV_OIM.DBF'
ORA-27041: unable to open file
OSD-04002: unable to open file
O / S-Error: (OS 2) The system can not find the file specified.
Errors in file D: \ APP \ ASUS \ diag \ rdbms \ orcl \ orcl \ trace \ orcl_ora_6572.trc:
ORA-01157: can not identify / lock data file 10 - see DBWR trace file
ORA-01110: data file 10: 'D: \ APP \ ASUS \ ORADATA \ ORCL \ DEV_OIM.DBF'
ORA-1157 signalled during: alter database open ...
it means that the Oracle database is unable to open one of these files, for example, with number 10.

To restore, follow these steps:

1. Connect to your database using the RMAN utility

$ Rman target / catalog ORCL / ***** @ rcat

2. Choose File recovery

RMAN> restore datafile 10;

3. coasting to a data file redo-information to the current state:

RMAN> recover datafile 10;

4. Open the database, if it is not already open:

$ $ ORACLE_HOME / bin / srvctl start database -d ORCLdb

OID 11g. Configure SSL features in OID 11g on a port other than the default

Oracle Internet Directory 11g. As it set up SSL on port 636
Usually, when the Oracle Internet Directory 11g is set to standard ports, there is no problem with SSL.

When you want to SSL working on port 636, you must configure SSL in accordance with article in the Oracle® Fusion Middleware Administrator's Guide for Oracle Internet Directory 11g Release 1 (11.1.1) Part Number E10029-02

http://docs.oracle.com/cd/E14571_01/oid.1111/e10029/ssl.htm

I set up through WLST, and as it turned out, there are errors in the article.

addSelfSignedCertificate function accepts input parameters is not 8, as indicated in the article, and 7.

I have it correctly configured to the following parameters addSelfSignedCertificate ( 'asinst_1', 'oid2', 'oid', 'oid', 'Zzzzzzzz', 'cn = oid', '512').

When configuring the file "myfile.prop" select an encryption algorithm.

Select the first of these "SSL_RSA_WITH_RC4_128_MD5".

Total received the following list of executed commands:

1. Run wlst

2. connect ( 'weblogic', 'Zzzzzzzz', '192.168.1.1:7001')

3. listWallets ( 'asinst_1', 'oid2', 'oid')

4. custom ()

5. ls ()

6. cd ( 'oracle.as.oid')

7. ls ()

8. listWallets ( 'asinst_1', 'oid2', 'oid')

9. createWallet ( 'asinst_1', 'oid2', 'oid', 'oid', 'Zzzzzzzz')

10. addSelfSignedCertificate ( 'asinst_1', 'oid2', 'oid', 'oid', 'Zzzzzzzz', 'cn = oid', '512')

11. configureSSL ( 'asinst_1', 'oid2', 'oid', 'sslport1', 'myfile.prop')

myfile.prop file is put in the directory / oracle / Oracle_IDM1 / common / bin, where ran ./wlst.sh

File contents:

KeyStore = oid
AuthenticationType = Server
SSLVersions = nzos_Version_1_0
Ciphers = SSL_RSA_WITH_RC4_128_MD5
SSLEnabled = true

12. Restart the OID

13. ./opmnctl updatecomponentregistration -adminHost 192.168.1.1 -adminPort 7001 -adminUsername weblogic -componentType OID -componentName oid2 -Port 389 636 -Sport

Done.

ORA-12560: TNS:protocol adapter error

ORA-12560: TNS: protocol adapter error in Windows
How to beat error ORA-12560: TNS: protocol adapter error in Windows
When connecting through sqlplus command "sqlplus / as sysdba" error message appears:

ORA-12560: TNS: protocol adapter error

In my case, the problem was solved by turning off UAC in Windows.

To turn off UAC in Windows, do the following:
1. Go to "Start" - "Control Panel" - "User Accounts" - "Change User Account Control Settings"
2. Slider drop to the lowest level.
3. Reboot the machine.
After these steps, I have all earned.

If this does not work, try:
1. Prescribe "SQLNET.AUTHENTICATION_SERVICES = (NTS)" in the sqlnet.ora file on the Oracle database server
2. Check whether the record of your database in the listener.ora file is present