Monday, August 17, 2015

Clean Oracle Database


Execute bellow commands to clean the database.


BEGIN
FOR c IN (SELECT table_name FROM user_tables) LOOP
EXECUTE IMMEDIATE ('DROP TABLE "' || c.table_name || '" CASCADE CONSTRAINTS');
END LOOP;

FOR s IN (SELECT sequence_name FROM user_sequences) LOOP
EXECUTE IMMEDIATE ('DROP SEQUENCE ' || s.sequence_name);
END LOOP;

FOR f IN (select object_name from user_objects where object_type = 'FUNCTION') LOOP
EXECUTE IMMEDIATE ('DROP FUNCTION ' || f.object_name);
END LOOP;

FOR t IN (select object_name from user_objects where object_type = 'TYPE') LOOP
EXECUTE IMMEDIATE ('DROP TYPE ' || t.object_name||' FORCE');
END LOOP;

FOR p IN (select object_name from user_objects where object_type = 'PROCEDURE') LOOP
EXECUTE IMMEDIATE ('DROP PROCEDURE ' || p.object_name);
END LOOP;

END;

Idoc Script for WebCenter Profile Security

Some Idoc Script for webcenter security implementation.

For Document CheckIn:-

<$if userHasRole("ChairmanAdmin")$>
<$isLinkActive=1$>
<$elseif userHasRole("ChairmanSubAdmin")$>
<$isLinkActive=1$>
<$elseif userHasRole("ChairmanContributor")$>
<$isLinkActive=1$>
<$endif$>

For Document Search:-

<$if userHasRole("ChairmanAdmin")$>
<$isLinkActive=1$>
<$elseif userHasRole("ChairmanSubAdmin")$>
<$isLinkActive=1$>
<$elseif userHasRole("ChairmanContributor")$>
<$isLinkActive=1$>
<$elseif userHasRole("ChairmanViewer")$>
<$isLinkActive=1$>
<$endif$>

Default Title Value:-

<$if #active.dDocType like "FinanceSupplierInvoice"$>
<$dprDefaultValue="Supplier Invoice"$>
<$endif$>

Default Drive Title :-
<$dprDerivedValue="Sales - "&#active.xOrderNumber$>
<$dprDerivedValue=#active.xSalesClassification&"  - "&#active.xOrderNumber$>


Introduction to IDOC Script

- Server Side scripting language

- <!--$script--> syntex used in HCSP,HCSF files.

- <!--$variable = "Hello World" -->

- Six Basic uses of Idoc are Include, Variables, Functions, Conditions, Looping, Administration Interface (allows you to use Idoc Script in content server applets and customizations).

- Include :
Define Include : <!--@dynamichtml name@>code<!--@end@> / <@dynamichtml name@>code<@end@>
Include in page : <!--$IncludeName$-->
- Standard includes are defined in the <install_dir>/shared/config/resources/std_page.htm file.
- Body Defination example :
<@dynamichtml body_def@>
<body
<$if background_image$>
background="<$HttpImagesRoot$><$background_image$>"
<$elseif colorBackground$>
bgcolor="<$colorBackground$>"
<$endif$>

<$if xpedioLook$>
link="#663399" vlink="#CC9900"
<$else$>
link="#000000" vlink="#CE9A63" alink="#9C3000"
<$endif$>
marginwidth="0" marginheight="0" topmargin="0" leftmargin="0"
>
<@end@>

- Include in page : <$include body_def$> / <!--$include body_def -->

- Super Tag - The super tag is used to define exceptions to an existing include. The super tag tells the include to start with an existing include and then add to it or modify using the specified code.

- Component Defined :  <@dynamichtml my_resource@> <$a = 1, b = 2$> <@end@>

- Enhances the my_resource include using the super tag
<@dynamichtml my_resource@> <$include super.my_resource$> <!--Change "b" but not "a" --><$b = 3$> <@end@>

- Creating variables : <$variable_name$> / <!--$variable_name -->  (i.e : <!--$a=10 -->)
 Standard configuration variables are defined in the config/config.cfg file.
 Using commas as separators <$a=1,b=2$> / <!--$a=1,b=2 -->

- Referencing a Variable in a Conditional <$if variable_name$>

- Functions : Global Functions, Personalization Functions (utGetValue,utLoad,utLoadResultSet)

- Conditionals : <$if condition$> Statement; <$else$> Statement; <$elseif condition$> Statement; <$endif$>
Boolean Operators - and (<$if 3>2 and 4>3$>), or <$if 3>2 or 3>4$>, not (<$if not 3=4$>)

- Looping : For loop ( <$loop ResultSet_name$> Statement; <$endloop$> ), While Loop (<$loopwhile condition$> Statement; <$endloop$>).
<$break$> causes the innermost loop to be exited.

- Administration Interface : You can use Idoc Script in several areas of the administration interface, including:
Workflow Admin (page -14), Web Layout Editor (page -14), Batch Loader (page -15), Archiver (page -15), System Properties (page -15), Search Expressions (page -15), E-mail (page -15)

- Special Keywords : #active (<$#active.variable$>),  #local (<$#local.variable$>), #env (<$#env.variable$>),exec (<$exec expression$>),
include (<$include ResourceName$>), super (<$include super.<include>$>)

- Keywords and Functions : exec keyword (), eval function, include keyword, inc function

- Operators : Comparison Operators (==, !=, <, <=, >, >= ) , Special String Operators ( &, Like, | (<$if "car" like "car|truck|van"$>) )

- MetaData Fields : All internal metadata field names begin with either a “d” (Predefined field names begin with a “d”. For example, dDocAuthor) or an “x” (Custom field names begin with an “x”. For example, xDepartment.)

Idoc Scripting:

Include :
Define:
<@dynamichtml name@>
code
<@end@>
Include in page:
<$include name$>

Standard includes are defined in the : <install_dir>/shared/config/resources/std_page.htm file.

Variable:

<$variable_name$> as <$variable=value$> as <$i=0$>
i.e <$a=1,b=2$>
Functions:

onditions:

• <$if condition$>
• <$else$>
• <$elseif condition$>
• <$endif$>

<$if xDepartment$>
<td><$xDepartment$></td>
<$else$>
<td>Department is not defined.</td>
<$endif$>
<$xDepartment=""$>

Looping:

<$name="SearchResults"$>
<$loop name$>
<!--output code-->
<$endloop$>
Instead, you need to use the following code:
<$name="SearchResults"$>
<$rsFirst(name)$>
<$loopwhile getValue(name, "#isRowPresent")$>
<!--output code-->
<$rsNext(name)$>
<$endloop$>


<$QueryText="dDocType <matches> ‘ADACCT‘"$>
<$executeService("GET_SEARCH_RESULTS")$>
<table>
<tr>
<td>Title</td><td>Author</td>
</tr>


<$loop SearchResults$>
<tr>
<td><a href="<$SearchResults.URL$>">
<$SearchResults.dDocTitle$></a></td>
<td><$SearchResults.dDocAuthor$></td>
</tr>
<$endloop$>
</table>

<$loopwhile condition$>
code
<$endloop$>


<$abc=0$>
<$loopwhile abc<10$>
<$abc=(abc+2)$>
<$endloop$>

Install and Configure Oracle Inbound Refinery

Install and Configure the IBR

Step 1) Connect to the Inbound Refinery at http://yourhostname:16250/ibr as the weblogic user, and the first-time use configuration screen will appear.

For this example, go with all the defaults.
Click Submit.
Restart WLS and the Managed Servers.

Step 2) Add an Inbound Refinery Provider.
Using the native webUI (http://localhost:16200/cs), select Administration / Providers, click on Add outgoing provider.
Enter the following:
- Provider Name: examplecs16250
- Provider Description: IBR provider
- Server Host Name: localhost
- HTTP Server Address: localhost:16250
- Server Port: 5555
- Instance Name: examplecs16250
- Relative Web Root: /ibr/
- select this checkbox: "Handles Inbound Refinery Conversion Jobs"
Click the Add button.
Restart WLS and the Managed Servers.

Step 3) Test to see that the new Provider is operational.
Using the native webUI (http://localhost:16200/cs), select Administration / Providers.
Click on Test provider "examplecs16250". It should state: "Good".

Step 4) Configure File Formats that will be used by the Refinery.
Using the native webUI (http://localhost:16200/cs), select Administration / Refinery Administration / File Formats Wizard
Select the all checkbox to select all file formats possible. Click the Update button.

Step 5) On the Inbound Refinery, enable PDF Export Converter.
Connect to the Inbound Refinery at http://yourhostname:16250/ibr, Administration / Admin Server, Component Manager, select the PDFExportConverter checkbox.
Click Update, then click OK.
Restart WLS and the Managed Servers.

Step 6) Set Primary Web Rendition to PDF.
Connect to the Inbound Refinery at http://yourhostname:16250/ibr, Conversion Settings / Primary Web Rendition.
Select the checkbox for "Convert to PDF using PDF Export".
Click the Update button.

INSTALLING THE IDC PDF CONVERTER PRINTER
Download Ghostscript (http://sourceforge.net/projects/ghostscript/) for resolve “The required printer 'IDC PDF Converter' is not installed. Queue monitoring will be turned off” error.
Installed the ghostscript.
1. Log in to the PDF Converter computer. Be mindful of the user account that you use.
The same user must be used to install Inbound Refinery and PDF Converter, install all
required third-party applications, and run Inbound Refinery and PDF Converter.

2. Close all other Windows programs.\

3. Create a c:\temp\ directory.

4. Launch the Windows Add Printer Wizard.

5. Click Next to continue.

6. Select the Local printer attached to this computer radio button, clear the
Automatically detect and install my Plug and Play printer check box, and click
Next to continue.
7. Select the Create a new port radio button, select Local Port from the drop-down
menu, and click Next to continue.

8. Enter c:\temp\idcoutput.ps as the port name, and click OK. The idcoutput.ps file does not need to exist in the temp directory; it will be created by PDF Converter.
9. Click Have Disk.

10. Click Browse.

11. Navigate to the PostScript printer driver that you want to use. If you are using AFPL
Ghostscript as your PostScript distiller engine, it is recommended that you use the
AFPL Ghostscript printer driver that is installed with AFPL Ghostscript. Navigate to
the ghostpdf.inf file located in the <ghostscript_install_dir>\lib\ directory.
Select the printer driver, and click Open.

12. Click OK to copy the printer files.

13. Click Next to continue. If you receive a message stating that driver is not digitally
signed, this is not an issue; you can still continue.
Important: Make sure that the Print Spooler service is installed and running on the
Inbound Refinery computer before attempting to install a printer. If this service is not
installed and running, Microsoft Windows will not allow any printers to be installed.
PDF Converter Installation and Administration Guide 4-11
Installing PDF Converter

14. Enter IDC PDF Converter for the printer name. The IDC PDF Converter printer can
be set as your default printer, but it does not have to be. Click Next to continue.

15. Select the Do not share this printer radio button and click Next to continue.

16. Select the No radio button to not print a test page and click Next to continue.

17. Click Finish to install the printer. If you receive a message stating the printer has not passed Windows testing, click Yes/Continue Anyway to continue.

18. When the printer is installed, right-click on the IDC PDF Converter printer icon and
select Properties to display the printer properties window.

19. On the General tab, make sure the printer is named IDC PDF Converter.

20. On the Sharing tab, make sure the Not shared/Do not share this printer radio button is selected.

21. On the Ports tab, make sure that the selected port is c:\temp\idcoutput.ps, and that it is specified as a Local Port. If the port has not been added, complete the following steps to add the port (the port only needs to be added once; if it was added correctly during the installation of the printer, it does not need to be added again):
a. Click Add Port.
b. In the list of available printer ports, select Local Port, and click New Port.
c. Specify c:\temp\idcoutput.ps as the port name, and click OK. The c:\temp\
directory must exist, but the idcoutput.ps file will be created by PDF Converter.
d. Click Close to close the Printer Ports dialog.

22. On the Advanced tab, make sure the Print directly to the printer radio button is
selected.

23. Click Apply to save any changes.

24. Click OK to close the printer properties window.


Identify if there are some Linux libraries missing and required for IBR

1.       Navigate to <mw_home>/Oracle_ECM1/oit/linux/lib/contentaccess and run the following commands :
      ldd oitconverter > oitoutput.txt
ldd exsimple > exoutput.txt
ldd textexport > textoutput.txt

Create the link / copy all the missing 32-Bit libs in the following folder.
/home/applowct/Oracle/Middleware/Oracle_ECM1/oit/linux/lib/contentaccess
I.E

yum install zlib-1.2.3-27.el6.i686
cp libz.so.1 <path>/oracle/middleware/Oracle_ECM1/oit/linux/lib/contentaccess/
cp libz.so.1.2.3 <path>/oracle/middleware/Oracle_ECM1/oit/linux/lib/contentaccess/

compat-libstdc++-33-3.2.3-69.el6.i686.rpm
libX11-1.3-2.el6.i686.rpm
libXau-1.0.1-3.1.i386.rpm
libxcb-1.7-1.el6.i686.rpm
zlib-1.2.3-27.el6.i686.rpm


Enabled Components
1.ContentFolios
2.ContentTracker
3.ContentTrackerReports
4.DynamicConverter
5.DesktopIntegrationSuite
6.DesktopTag
7.EmailMetaData
8.FrameWorkFolders
9.AppAdapterCore
10.AppAdapterEBS
11.IPMRepository
12.AutoSuggestConfig
13.DynamicConverter
14.FrameWorkFolders

Error While Creating Domain



Preparing...
Extracting Domain Contents...
Creating Domain Security Information...
Domain Creation Failed!

Domain Location: C:\Oracle\Middleware\user_projects\domains\<<DOMAIN>>

Reason: null

Exception:

Traceback (innermost last):
  File "<iostream>", line 155, in ?
  File "<iostream>", line 53, in writeUcmAutoInstallFile
  File "C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules\jython-modules.jar\Lib/javaos$py.class", line 334, in system
  File "C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules\jython-modules.jar\Lib/popen2.py", line 235, in system
  File "C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules\jython-modules.jar\Lib/popen2.py", line 72, in __init__
  File "C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules\jython-modules.jar\Lib/javashell.py", line 64, in execute
OSError: (0, 'Failed to execute command ([\'sh\', \'-c\', \'chmod 755 C:\\\\Oracle\\\\Middleware\\\\user_projects\\\\domains\\\\<<DOMAIN>>/ucm/cs/bin/autoinstall.cfg\']): java.io.IOException: Cannot run program "sh": CreateProcess error=2, The system cannot find the file specified')



Solution ::

To solve this we need to patch the jython-modules.jar. For default JDeveloper installation path we need to go to C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules and extract the jython-modules.jar using an utility like 7-zip. Then we need to open the javashell.py python script inside lib folder and add at line 139 a String for Windows 8 OS:

_osTypeMap = (
        ( "nt", ( 'nt', 'Windows NT', 'Windows NT 4.0', 'WindowsNT',
                  'Windows 2000', 'Windows 2003', 'Windows XP', 'Windows CE',
                  'Windows Vista', 'Windows Server 2008', 'Windows 7', 'Windows 8' )),
        ( "dos", ( 'dos', 'Windows 95', 'Windows 98', 'Windows ME' )),
        ( "mac", ( 'mac', 'MacOS', 'Darwin' )),
        ( "None", ( 'None', )),
        )

Find Latest MLR for Oracle WebCenter Content

Follow bellow steps to find the latest MLR on Oracle Support.

1. In the Search tab select the Product or Family (Advanced) link

2. In the Product drop down menu select Oracle Webcenter Content

3. In the Release drop down menu select FMW 11.1.1.8.0

4. Click the Search button

Look for the WCC 11.1.1.8.0 BUNDLE with the highest MLR number

Oracle WebCenter Content Installation




Follow bellow steps to install oracle webcenter content on windows server.


1. Install JDK 1.7.0_26+

2. Install Oracle Date and dont forgot to change the character set
*. RCU Fails With Non-AL32UTF8 Character Set (Doc ID 1063712.1)

3. Install WebLogic 10.3.6. for WebCenter 11.1.8
java -D64 -jar wls1036_generic.jar
setup.exe -jreLoc

4. Setup Node manager
java weblogic.WLST
connect ('weblogic','<<password>>','t3://localhost:7001')
nmEnroll(domainDir='C:/Oracle/Middleware/user_projects/domains/webcenter',nmHome='C:/Oracle/Middleware/wlserver_10.3/common/nodemanager')

5. Create domain ( Middleware\oracle_common\common\bin\config.cmd  -log=webcente.log)

6. Install Visual C++ 2005 SP1 Redistributable Package (both x86 and x64) ( Doc ID 1322380.1)

7. Configure IBR add provider on RIDC port.

AWS EC2 - SSH locked with UFW

Need to update the instance's user data: 1. Stop the instance 2. Right click (windows) or ctrl + click (Mac) on the instance to open a c...