Purge dba_recyclebin as dba system
Hi all,
Why can not SYSTEM dba user can not purge dba_recyclebin?
SQL> connect system/manager
Connected.
SQL> l
1* purge dba_recyclebin
SQL> /
purge dba_recyclebin
ERROR at line 1:
ORA-01031: insufficient privileges
I thank you all.....
Because you need SYSDBA privileges.
Please read PURGE documentation in SQL Reference:
>
DBA_RECYCLEBIN
This clause is valid only if you have SYSDBA system privilege. It lets you remove all objects from the system-wide recycle bin, and is equivalent to purging the recycle bin of every user. This operation is useful, for example, before backward migration.
Similar Messages
-
How to User Purge Recyble bin as System
Hi all,
I want to purge scott's recycle bin as user "SYSTEM". Because I do not know the user's password. How do I achieve it?
SQL> purge scott.recycle bin;
purge scott.recycle bin
ERROR at line 1:
ORA-38302: invalid PURGE option
Thanks a lot,
KinzKinsaKaUy? wrote:
You mean that you want to purge Scott's recyclebin being System? The user Scott would be able to purge its own recyclebin isn't it? Yes but they it is not of their concern to maintain it.
I tried "purge dba_recyclebin" as system but I got "insuficient privilege error" as I need to be SYSDBA. I only allowed to login as SYSTEM and I know this has "dba" privilege.
Any other uptions?
What is this purge tablespace users scott?This would drop only that user(Scott in this case) objects from the mentioned tablespace. If you can't use this, method suggested by Fran would be the way to go.
Aman.... -
In r12 What is use of Purge log and Closed system alerts
Hi
In r12 What is use Concurrent reqest "Purge logs and Closed system alerts "
is there any diffrence with "Purge Concurrent Request and/or Manager Data Program"
we have to purge cm logs and data.
'In r12 What is use Concurrent reqest "Purge logs and Closed system alerts "The concurrent program "Purge Debug Log and System Alerts" (Short name: FNDLGPRG) is the recommended way to purge messages. This program purges all messages up to the specified date, except messages for active transactions (new or open alerts, active ICX sessions, concurrent requests, and so on). This program is by default scheduled to run daily and purge messages older than 7 days. Internally this concurrent program invokes the FND_LOG_ADMIN APIs, which are described later in this document.
Oracle® Applications Supportability Guide Release 12
http://download.oracle.com/docs/cd/B40089_09/current/acrobat/120fndsupp.pdf
is there any diffrence with "Purge Concurrent Request and/or Manager Data Program" This concurrent program is used to purge concurrent requests log/out file, and/or CM log files.
we have to purge cm logs and data.Use "Purge Concurrent Request and/or Manager Data" concurrent program. -
All,
My oracle version : 11.2.0.2
Can someone help me to fix this sql ? I'm doing mistake at converting date function and trying to make a count of dropped objects before purge older than 15 days.
SQL> select count(*) from dba_recyclebin where to_date('droptime','YYYY-MM-DD:HH:MI:SS') > to_date('sysdate','YYYY-MM-DD:HH:MI:SS')-15;
select count(*) from dba_recyclebin where to_date('droptime','YYYY-MM-DD:HH:MI:SS') > to_date('sysdate','YYYY-MM-DD:HH:MI:SS')-15
ERROR at line 1:
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
ThanksYou also have a problem with your date format mask, it needs to be 24 hour clock.
orcl112> select count(*) from dba_recyclebin where to_date(droptime,'YYYY-MM-DD:HH24:MI:SS') > sysdate-15;
COUNT(*)
6
orcl112> select count(*) from dba_recyclebin where to_date(droptime,'YYYY-MM-DD:HH:MI:SS') > sysdate-15;
select count(*) from dba_recyclebin where to_date(droptime,'YYYY-MM-DD:HH:MI:SS') > sysdate-15
ERROR at line 1:
ORA-01849: hour must be between 1 and 12
orcl112> select count(*) from dba_recyclebin where to_date(droptime,'YYYY-MM-DD:HH24:MI:SS') > sysdate-15;
COUNT(*)
6
orcl112> -
Hi,
I am using Oracle 10g (10.2.0.2.0).
I am having problems purging the recyclebin, when connected as dbadmin.
When I tried to do a purge recyclebin, I was left with only 2 objects in the recyclebin, and got an error -
SQL> purge recyclebin;
purge recyclebin
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-02449: unique/primary keys in table referenced by foreign keys
The objects in the database are:
SQL> select object_name, original_name, type, can_undrop, can_purge, droptime, ts_name
from recyclebin;
object_name original_name type can_undrop can_purge droptime ts_name
=========================================================================================
SYS_IL0000011599C00063$$ SYS_IL0000011599C00063$$ LOB INDEX NO NO 2010-10-08:09:13:34 small_tables
SYS_LOB0000011599C00063$$ SYS_LOB0000011599C00063$$ LOB NO NO 2010-10-08:09:13:34 small_tables
If I try connecting as sysdba, and purging the dba_recyclebin, it says purged -
sqlplus as sysdba
SQL> purge dba_recyclebin;
DBA Recyclebin purged.
But, I still see the objects in the recyclebin. Doing a purge tablespace gives me the same error -
SQL> purge tablespace small_tables;
purge tablespace small_tables
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-02449: unique/primary keys in table referenced by foreign keys
Any help would be greatly appreciated.
Thanks.Use this to find the dependents,
select owner, constraint_name,table_name,index_owner,index_name
from dba_constraints
where (index_owner,index_name) in (select owner,index_name from dba_indexes
where tablespace_name='YOUR_TABLESPACE IN UPPER CASE');
Now disable the referenced constraints and purge the tablespace.
SQL> ALTER TABLE table_name DISABLE CONSTRAINT constraint_name;
Thanks -
How to purge Item/Categories open interface tables
Hi,
We are importing items into oracle inventory using oracle open interface tables. There is some existing data in the standard interface tables mtl_system_items_interface and mtl_revision_interface that we need to remove. What is the best way to do this? IS hard deleting an option? Are there any links with other tables that we need to take into consideration? (eg. mtl_interface_error)
I could not find what oracle suggests about this. Please share any info you have.
Thanks
AMHi Am;
What is your EBS? Pelase check below note which could be helpful for your issue:
APC/PIM Item Attribute Import Performance Slow FAQ - Purging Interface? Why Do Successful User Defined Attributes (UDAs) Remain In the Interface (EGO_ITM_USR_ATTR_INTRFC) [ID 1101824.1]
Purging Strategy for eBusiness Suite 11i) [ID732713.1] << its for 12 too
Also see:
http://oracleappstechnology.blogspot.com/2008/12/in-built-data-purge-concurrent-programs.html
In r12 What is use of Purge log and Closed system alerts
Purge Debug Log And System Alerts Performance Issues
Regard
Helios -
Data archival and purging for OLTP database
Hi All,
Need your suggestion regarding data archival and purging solution for OLTP db.
currently, we are planning to generate flat files from table..before purging the inactive data and move them to tapes/disks for archiving then purge the data from system. we have many retention requirements and conditions before archival of data. so partition alone is not sufficient.
Is there any better approach for archival and purging other than this flat file approach..
thank you.
regards,
varauser11261773 wrote:
Hi All,
Need your suggestion regarding data archival and purging solution for OLTP db.
currently, we are planning to generate flat files from table..before purging the inactive data and move them to tapes/disks for archiving then purge the data from system. we have many retention requirements and conditions before archival of data. so partition alone is not sufficient.
Is there any better approach for archival and purging other than this flat file approach..
thank you.
regards,
varaFBDA is the better option option .Check the below link :
http://www.oracle.com/pls/db111/search?remark=quick_search&word=flashback+data+archive
Good luck
--neeraj -
How to check the objects size in DBA_RECYCLEBIN
Hi All,
I want to purge dba_recyclebin, before that i want to check the size of all objects residing in dba_recyclebin.
I am using below query to goup by tablespace.
SELECT TS_NAME, SUM(SPACE*1024)/1024/1024/1024 AS "Size in GB" FROM DBA_RECYCLEBIN GROUP BY TS_NAME order by 2 desc
Kindly inform me is the correct way to check it. for example if the 10gb space is shown from this query, will i able to see 10GB free space after purging. Kindly confirm
Thanks
KrishnaI am using below query to goup by tablespace.
SELECT TS_NAME, SUM(SPACE*1024)/1024/1024/1024 AS "Size in GB" FROM DBA_RECYCLEBIN GROUP BY TS_NAME order by 2 desc
As I mentioned, the SPACE field is in terms of BLOCKS rather than bytes.
First confirm your database block size using
SQL> show parameter db_block_size
then modify the query as
SQL> SELECT TS_NAME, SUM(SPACE*<DB_BLOCK_SIZE>)/1024/1024/1024 AS "Size in GB" FROM DBA_RECYCLEBIN GROUP BY TS_NAME order by 2 desc;
I am quite sure the db_block_size in your database is 8192.
Since you have used 1024 instead 8192 as the block size, you are seeing the difference in DBA_RECYCLEBIN and DBA_SEGMENTS -
Purging OSB Alerts using WLST scripts
Hi,
I am using the below script to purge the OSB Alerts. I am connecting to the OSB managed server to purge the alerts.
*# Connect to server*
* connect(weblogic,welcome,intdev:8011)*
* # Calculate the start and end time for purging the alerts*
* now=System.currentTimeMillis()*
* startTime=0*
* endTime=(now - days*3600*24*1000)*
* # Purging the Alerts*
* serverRuntime()*
* print "Deleting records older than", days, "days from OSB Alerts"*
* print cmo*
* alsbAlerts = cmo.getWLDFRuntime().getWLDFAccessRuntime().lookupWLDFDataAccessRuntime('CUSTOM/com.bea.wli.monitoring.alert')*
* numDeleted = alsbAlerts.deleteDataRecords(startTime,endTime,"")*
* print "No. of Alerts deleted =", numDeleted*
* # Disconnect from the domain*
* disconnect()*
I am getting the below error while executing the script
Successfully connected to managed Server 'osb_server1' that belongs to domain 'soa_domain'.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
Location changed to serverRuntime tree. This is a read-only tree with ServerRuntimeMBean as the root.
For more help, use help(serverRuntime)
Deleting records older than 60 days from OSB Alerts
+[MBeanServerInvocationHandler]com.bea:Name=osb_server1,Type=ServerRuntime+
Disconnected from weblogic server: osb_server1
Unexpected error: weblogic.management.ManagementException
Problem invoking WLST - Traceback (innermost last):
File "/home/soadev/WLST/FINAL/purging/purge_Alerts.py", line 41, in ?
weblogic.management.ManagementException:
at weblogic.diagnostics.accessor.WLSAccessorMBeanFactoryImpl.createDiagnosticDataAccessRuntime(WLSAccessorMBeanFactoryImpl.java:206)
at weblogic.diagnostics.accessor.AccessRuntime.lookupDataAccessRuntime(AccessRuntime.java:315)
at weblogic.diagnostics.accessor.DiagnosticAccessRuntime.lookupWLDFDataAccessRuntime(DiagnosticAccessRuntime.java:77)
at weblogic.diagnostics.accessor.DiagnosticAccessRuntime.lookupWLDFDataAccessRuntime(DiagnosticAccessRuntime.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.management.jmx.modelmbean.WLSModelMBean.invoke(WLSModelMBean.java:437)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
at weblogic.management.mbeanservers.internal.JMXContextInterceptor.invoke(JMXContextInterceptor.java:268)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
at weblogic.management.mbeanservers.internal.SecurityInterceptor.invoke(SecurityInterceptor.java:444)
at weblogic.management.jmx.mbeanserver.WLSMBeanServer.invoke(WLSMBeanServer.java:323)
at weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder$11$1.run(JMXConnectorSubjectForwarder.java:663)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder$11.run(JMXConnectorSubjectForwarder.java:661)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder.invoke(JMXConnectorSubjectForwarder.java:654)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265)
at java.security.AccessController.doPrivileged(Native Method)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1367)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)
at javax.management.remote.rmi.RMIConnectionImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
+Caused by: weblogic.management.ManagementException: [Diagnostics:320103]There was an error creating the DiagnosticDataRuntimeMBean instance with the given logical name CUSTOM/com.bea.wli.monitoring.alert.+
at weblogic.diagnostics.accessor.WLSAccessorMBeanFactoryImpl.createDataAccessRuntime(WLSAccessorMBeanFactoryImpl.java:228)
at weblogic.diagnostics.accessor.WLSAccessorMBeanFactoryImpl.access$000(WLSAccessorMBeanFactoryImpl.java:55)
at weblogic.diagnostics.accessor.WLSAccessorMBeanFactoryImpl$1.run(WLSAccessorMBeanFactoryImpl.java:201)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.diagnostics.accessor.WLSAccessorMBeanFactoryImpl.createDiagnosticDataAccessRuntime(WLSAccessorMBeanFactoryImpl.java:197)
+... 39 more+
weblogic.management.ManagementException: weblogic.management.ManagementException:
Please provide pointers to get rid of this issue.
Edited by: Chintan Parekh on Jun 1, 2011 2:41 AMPlease refer -
http://blogs.oracle.com/MarkSmith/entry/osb_alerts_purging_is_essentia
From the blog -
The components that make up WLDF will be targeted to a single managed server in a clustered environment or to the Admin server in a single server environment. To establish what managed server this is, check to see where the WLI Aggregator application is targeted to. The WLDF data will be stored under this single managed server in the following location: //domain_name/servers/server_name/data/store/diagnostics/Check that on which server WLI Aggregator application is targeted and connect to that server from your script.
Regards,
Anuj -
How to purge EBS data without deleting any setup or configuration details
Today I get a very interesting requirement. We have a one year old instance. Now, senior management wants to remove/purge/delete all transactional data though they want to keep all the EBS suite R12.1 setup and configuration information. I do not have any idea how can I achieve this. Please help me on this regard.
Hi Su;
Please see:
Purging Strategy for eBusiness Suite 11i [ID 732713.1]
Also see:
http://oracleappstechnology.blogspot.com/2008/12/in-built-data-purge-concurrent-programs.html << r11 iicin hepsi burda
In r12 What is use of Purge log and Closed system alerts
Purge Debug Log And System Alerts Performance Issues
Regard
Helios -
Oracle 10.2.0.4 to 11.2.0.3 upgrade
Hi All,
I have a BI EHP2 system with Linux / Oracle 10.2.0.4 .
We are into the upgrade process > We are getting some error during the pre_upgrade scripts.
SQL> @pre_upgrade_tasks.sql
================================
=== PRE-UPGRADE Tasks: START ===
================================
Date Time
2012-03-08 18:33:58
Recompiling invalid objects
This reduces the number of invalid objects as much as possible.
TIMESTAMP
COMP_TIMESTAMP UTLRP_BGN 2012-03-08 18:33:58
PL/SQL procedure successfully completed.
TIMESTAMP
COMP_TIMESTAMP UTLRP_END 2012-03-08 18:34:15
PL/SQL procedure successfully completed.
DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
7
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
1
PL/SQL procedure successfully completed.
Purging Recyclebin
This reduces the time needed for upgrading the database.
SQL> PURGE DBA_RECYCLEBIN;
DBA Recyclebin purged.
SQL> SET ECHO OFF
Gathering Oracle Dictionary Statistics
This reduces the time needed for upgrading the database.
SQL> EXECUTE dbms_stats.gather_dictionary_stats;
PL/SQL procedure successfully completed.
SQL> SET ECHO OFF
Running Pre-Upgrade-Information Tool utlu112i.sql
This is a mandatory task for manual database upgrades.
This tool is also run in pre_upgrade_status.sql.
Oracle Database 11.2 Pre-Upgrade Information Tool 03-08-2012 18:37:32
Script Version: 11.2.0.3.0 Build: 001
Database:
--> name: CD1
--> version: 10.2.0.4.0
--> compatible: 10.2.0
--> blocksize: 8192
--> platform: Linux x86 64-bit
--> timezone file: V4
Tablespaces: [make adjustments in the current environment]
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 966 MB
--> PSAPUNDO tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 377 MB
--> PSAPTEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
Flashback: OFF
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit database.
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
--> If Target Oracle is 64-Bit, refer here for Update Parameters:
-- No update parameter changes are required.
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
-- No renamed parameters found. No changes are required.
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
--> remote_os_authent 11.1 DEPRECATED
--> background_dump_dest 11.1 DEPRECATED replaced by "diagnostic_dest"
--> user_dump_dest 11.1 DEPRECATED replaced by "diagnostic_dest"
Components: [The following database components will be upgraded or installed]
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] INVALID
Miscellaneous Warnings
WARNING: --> Database is using a timezone file older than version 14.
.... After the release migration, it is recommended that DBMS_DST package
.... be used to upgrade the 10.2.0.4.0 database timezone version
.... to the latest version which comes with the new release.
WARNING: --> Database contains INVALID objects prior to upgrade.
.... The list of invalid SYS/SYSTEM objects was written to
.... registry$sys_inv_objs.
.... The list of non-SYS/SYSTEM objects was written to
.... registry$nonsys_inv_objs.
.... Use utluiobj.sql after the upgrade to identify any new invalid
.... objects due to the upgrade.
.... USER SYS has 8 INVALID objects.
===================================
=== PRE-UPGRADE Tasks: FINISHED ===
===================================
SQL> spool off
There are 2 errors
1.)Object with errors or invalid objects
2.) recompilation error
1.) Object with errors or invalid objects
These are 7 object
AQ$_KUPC$DATAPUMP_QUETAB_V
KUPC$DATAPUMP_QUETAB
SYSNTuqbWKWtJPc7gQMEKFx9cXA==
SYSNTuqbWKWtLPc7gQMEKFx9cXA==
SYSNTuqbWKWtNPc7gQMEKFx9cXA==
AQ$_KUPC$DATAPUMP_QUETAB_F
AQ$_KUPC$DATAPUMP_QUETAB
2.)recompilation error
We queried the UTL_RECOMP_ERRORS table and found
156977
09-MAR-12 10.08.35.
ORA-01403: no data found
ORA-01403: no data found.
Please suggest how to proceed.
Br
AnthonyHello Anthony,
even maybe not on Windows (I faced this on Unix), proceed with invalid objects as in : Note 1453935 - Invalid DataPump objects after Windows patch collection > 25
this is the leftover of some previous 10g patching. Once objects are recreated, recompilation will go ok.
Regards,
Igor -
Based on an xsd schema create a table
Hi all,
i need a way that allow me to create a table having an xsd file, in others word i load the xsd schema and create a table accordingly to the element that the xsd schema has respecting also the datatype of every element.
Is the some functionality that allow me to do a thing like that?
thanks to every one
Francesco
ItalyI should now give the following output
Connected.
SQL> set termout on
SQL> set feed on
SQL>
SQL> drop user test cascade;
User dropped.
SQL>
SQL> purge dba_recyclebin;
DBA Recyclebin purged.
SQL>
SQL> create user test identified by test;
User created.
SQL>
SQL> grant xdbadmin, dba to test;
Grant succeeded.
SQL>
SQL>
SQL> connect test/test
Connected.
SQL>
SQL> set echo on
SQL> set termout on
SQL> set feed on
SQL> set long 100000
SQL> set pages 5000
SQL>
SQL> var schemaPath varchar2(256)
SQL> var schemaURL varchar2(256)
SQL>
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Create an XML Schema root.xsd in directory /public/
SQL>
SQL> ----------------------------------------------------------
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<?xml version="1.0" encoding="UTF-8"?>
5 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
6 xmlns:xdb="http://xmlns.oracle.com/xdb"
7 elementFormDefault="qualified"
8 attributeFormDefault="unqualified"
9 xdb:storeVarrayAsTable="true">
10 <xs:element name="ROOT" xdb:defaultTable="ROOT_TABLE" xdb:maintainDOM="false">
11 <xs:annotation>
12 <xs:documentation>Example XML Schema</xs:documentation>
13 </xs:annotation>
14 <xs:complexType xdb:maintainDOM="false">
15 <xs:sequence>
16 <xs:element name="ID" type="xs:integer" xdb:SQLName="ID"/>
17 <xs:element ref="INFO" xdb:SQLInline="false" />
18 </xs:sequence>
19 </xs:complexType>
20 </xs:element>
21 <xs:element name="INFO" xdb:SQLName="INFO_TYPE">
22 <xs:complexType xdb:maintainDOM="false">
23 <xs:sequence>
24 <xs:element name="INFO_ID" type="xs:integer" xdb:SQLName="TYPE_INFO_ID"/>
25 <xs:element name="INFO_CONTENT"
26 xdb:SQLName="TYPE_INFO_CONTENT" type="xs:string"/>
27 </xs:sequence>
28 </xs:complexType>
29 </xs:element>
30 </xs:schema>');
31 begin
32 if (dbms_xdb.existsResource(:schemaPath)) then
33 dbms_xdb.deleteResource(:schemaPath);
34 end if;
35 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
36 end;
37 /
PL/SQL procedure successfully completed.
SQL>
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Selecting repository files and folders via XDBUriType
SQL>
SQL> ----------------------------------------------------------
SQL> select xdbURIType ('/public/root.xsd').getClob()
2 from dual;
XDBURITYPE('/PUBLIC/ROOT.XSD').GETCLOB()
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.o
racle.com/xdb" elementFormDefault="qualified" attributeFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xs:element name="ROOT" xdb:defaultTable="ROOT_TABLE" xdb:maintainDOM="false">
<xs:annotation>
<xs:documentation>Example XML Schema</xs:documentation>
</xs:annotation>
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="ID" type="xs:integer" xdb:SQLName="ID"/>
<xs:element ref="INFO" xdb:SQLInline="false"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="INFO" xdb:SQLName="INFO_TYPE">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="INFO_ID" type="xs:integer" xdb:SQLName="TYPE_INFO_ID"/
>
<xs:element name="INFO_CONTENT" xdb:SQLName="TYPE_INFO_CONTENT" type="xs
:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
1 row selected.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Create an XML Document root.xml in directory /public/
SQL>
SQL> ----------------------------------------------------------
SQL> begin
2 :schemaURL := 'http://www.myserver.com/root.xml';
3 :schemaPath := '/public/root.xml';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<?xml version="1.0" encoding="UTF-8"?>
5 <ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="root.xsd">
6 <ID>0</ID>
7 <INFO>
8 <INFO_ID>0</INFO_ID>
9 <INFO_CONTENT>Text</INFO_CONTENT>
10 </INFO>
11 </ROOT>');
12 begin
13 if (dbms_xdb.existsResource(:schemaPath)) then
14 dbms_xdb.deleteResource(:schemaPath);
15 end if;
16 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
17 end;
18 /
PL/SQL procedure successfully completed.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Selecting repository files and folders via XDBUriType
SQL>
SQL> ----------------------------------------------------------
SQL> select xdbURIType ('/public/root.xml').getClob()
2 from dual;
XDBURITYPE('/PUBLIC/ROOT.XML').GETCLOB()
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchem
aLocation="root.xsd">
<ID>0</ID>
<INFO>
<INFO_ID>0</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>
1 row selected.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Register the XML Schema and create the OR objects
SQL>
SQL> ----------------------------------------------------------
SQL> select * from tab;
no rows selected
SQL> --
SQL> alter session set events='31098 trace name context forever';
Session altered.
SQL> --
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema
3 (SCHEMAURL => 'root.xsd',
4 SCHEMADOC => xdbURIType('/public/root.xsd').getClob(),
5 LOCAL => FALSE, -- local
6 GENTYPES => TRUE, -- generate object types
7 GENBEAN => FALSE, -- no java beans
8 GENTABLES => TRUE, -- generate object tables
9 OWNER => USER
10 );
11 END;
12 /
PL/SQL procedure successfully completed.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
INFO1902_TAB TABLE
INFO1904_TAB TABLE
ROOT_TABLE TABLE
3 rows selected.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- Insert some data with XDBURIType
SQL>
SQL> ----------------------------------------------------------
SQL> DECLARE
2 XMLData xmlType := xmlType(xdbURIType ('/public/root.xml').getClob());
3 BEGIN
4 for i in 1..10
5 loop
6 insert into ROOT_TABLE
7 VALUES
8 (XMLData);
9 end loop;
10 END;
11 /
PL/SQL procedure successfully completed.
SQL> -- randomize the data a little
SQL> update ROOT_TABLE
2 set object_value = updateXML(object_value,
3 '/ROOT/ID/text()',
4 substr(round(dbms_random.value*100),0,2)
5 );
10 rows updated.
SQL> update ROOT_TABLE
2 set object_value = updateXML(object_value,
3 '/ROOT/INFO/INFO_ID/text()',
4 substr(round(dbms_random.value*100),0,2)
5 );
10 rows updated.
SQL> pause
SQL> ----------------------------------------------------------
SQL>
SQL> -- End Result
SQL>
SQL> ----------------------------------------------------------
SQL> select count(*) from root_table;
COUNT(*)
10
1 row selected.
SQL> select * from root_table where rownum <= 2;
SYS_NC_ROWINFO$
<?xml version="1.0" encoding="US-ASCII"?>
<ROOT>
<ID>54</ID>
<INFO>
<INFO_ID>28</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>
<?xml version="1.0" encoding="US-ASCII"?>
<ROOT>
<ID>33</ID>
<INFO>
<INFO_ID>35</INFO_ID>
<INFO_CONTENT>Text</INFO_CONTENT>
</INFO>
</ROOT>
2 rows selected.
SQL> -
Solve oracle multimedia post upgrade errors
Hello,
I performed and out of place upgrade from oracle 10.2.0.4 to 11.2.0.4.
when I run the postupgrade script i have issues on oracle multimedia that i cannot solve.. it is about shared memory. I followed all the recommendations suggested on the pre-upgrade script.
SQL> @/oracle/product/11.2.0.4/dbhome_1/rdbms/admin/utlu112s.sql
Oracle Database 11.2 Post-Upgrade Status Tool 10-03-2014 15:06:57
Component Current Version Elapsed Time
Name Status Number HH:MM:SS
Oracle Server
. VALID 11.2.0.4.0 00:14:07
JServer JAVA Virtual Machine
. VALID 11.2.0.4.0 00:11:08
Oracle Workspace Manager
. VALID 11.2.0.4.0 00:00:48
Oracle Enterprise Manager
. VALID 11.2.0.4.0 00:09:58
Oracle XDK
. VALID 11.2.0.4.0 00:02:48
Oracle Text
. VALID 11.2.0.4.0 00:00:59
Oracle XML Database
. VALID 11.2.0.4.0 00:05:45
Oracle Database Java Packages
. VALID 11.2.0.4.0 00:00:20
Oracle Multimedia
. ORA-00604: error occurred at recursive SQL level 1 ORA-04031: unable to
allocate 32 bytes of shared memory ("shared pool","select col#, grantee#,
privi...","KGLH0^34b96f2","kglHeapInitialize:temp")
ORA-06512: at
"SYS.DBMS_JAVA", line 655
ORA-06512: at line 1
. ORA-04031: unable to allocate 32 bytes of shared memory ("shared
pool","select col#, grantee#,
privi...","KGLH0^34b96f2","kglHeapInitialize:temp")
ORA-06512: at
"SYS.DBMS_JAVA", line 655
ORA-06512: at line 1
. col#, grantee#, privi...","KGLH0^34b96f2","kglHeapInitialize:temp")
ORA-06512: at "SYS.DBMS_JAVA", line 655
ORA-06512: at line 1
. ORA-06512: at "SYS.DBMS_JAVA", line 655 ORA-06512: at line 1
. ORA-06512: at line 1
. ORA-00604: error occurred at recursive SQL level 1 ORA-04031: unable to
allocate 136 bytes of shared memory ("shared pool","select
i.obj#,i.ts#,i.file#,...","KGLH0^4006e26c","wds: qksmmGetWorkArea")
ORA-06512:
at "SYS.DBMS_JAVA", line 655
ORA-06512: at line 1
. ORA-04031: unable to allocate 136 bytes of shared memory ("shared
pool","select i.obj#,i.ts#,i.file#,...","KGLH0^4006e26c","wds:
qksmmGetWorkArea")
ORA-06512: at "SYS.DBMS_JAVA", line 655
ORA-06512: at line 1
. i.obj#,i.ts#,i.file#,...","KGLH0^4006e26c","wds: qksmmGetWorkArea")
ORA-06512: at "SYS.DBMS_JAVA", line 655
ORA-06512: at line 1
. ORA-06512: at "SYS.DBMS_JAVA", line 655 ORA-06512: at line 1
. ORA-06512: at line 1
. ORA-04045: errors during recompilation/revalidation of
ORDSYS./f87ac59f_DicomEngine
ORA-04031: unable to allocate 32 bytes of shared
memory ("shared pool","ALTER JAVA CLASS
"ORDSYS"."/...","KGLH0^1182baa5","kglHeapInitialize:temp")
ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN_PRV", line 6945
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN",
line 276
ORA-06512: at line 1
. ORDSYS./f87ac59f_DicomEngine ORA-04031: unable to allocate 32 bytes of
shared memory ("shared pool","ALTER JAVA CLASS
"ORDSYS"."/...","KGLH0^1182baa5","kglHeapInitialize:temp")
ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN_PRV", line 6945
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN",
line 276
ORA-06512: at line 1
. ORA-04031: unable to allocate 32 bytes of shared memory ("shared
pool","ALTER JAVA CLASS
"ORDSYS"."/...","KGLH0^1182baa5","kglHeapInitialize:temp")
ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN_PRV", line 6945
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN",
line 276
ORA-06512: at line 1
. JAVA CLASS "ORDSYS"."/...","KGLH0^1182baa5","kglHeapInitialize:temp")
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN_PRV", line 6945
ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN", line 276
ORA-06512: at line 1
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN_PRV", line 6945 ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN", line 276
ORA-06512: at line 1
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN", line 276 ORA-06512: at line 1
. ORA-06512: at line 1
. ORA-53051: no editDataModel session found ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN_PRV", line 6306
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN",
line 125
ORA-06512: at line 14805
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN_PRV", line 6306 ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN", line 125
ORA-06512: at line 14805
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN", line 125 ORA-06512: at line 14805
. ORA-06512: at line 14805
. ORA-53051: no editDataModel session found ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN_PRV", line 6306
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN",
line 125
ORA-06512: at line 67
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN_PRV", line 6306 ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN", line 125
ORA-06512: at line 67
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN", line 125 ORA-06512: at line 67
. INVALID 11.2.0.4.0 00:55:05
Spatial
. OPTION OFF 10.2.0.4.0 00:00:00
Oracle Expression Filter
. VALID 11.2.0.4.0 00:00:16
Oracle Rules Manager
. VALID 11.2.0.4.0 00:00:14
Final Actions
. 00:01:34
Total Upgrade Time: 01:43:11
PL/SQL procedure successfully completed.
thank you
Mario.I explicity set up the sga_target to 668MB as suggested by the pre-upgrade script.
see the output of preugrade tool:
SQL> @/oracle/utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 10-02-2014 17:24:25
Script Version: 11.2.0.4.0 Build: 001
Database:
--> name: FUELPLUS
--> version: 10.2.0.4.0
--> compatible: 10.2.0.3.0
--> blocksize: 8192
--> platform: Solaris Operating System (x86-64)
--> timezone file: V4
Tablespaces: [make adjustments in the current environment]
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 1071 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 804 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
Flashback: OFF
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit database.
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
WARNING: --> "sga_target" needs to be increased to at least 484 MB
--> If Target Oracle is 64-Bit, refer here for Update Parameters:
WARNING: --> "sga_target" needs to be increased to at least 668 MB
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
-- No renamed parameters found. No changes are required.
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
--> cursor_space_for_time 11.1 DEPRECATED
--> background_dump_dest 11.1 DEPRECATED replaced by "diagnostic_dest"
--> user_dump_dest 11.1 DEPRECATED replaced by "diagnostic_dest"
--> cursor_space_for_time 11.2 DEPRECATED
Components: [The following database components will be upgraded or installed]
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Data Mining [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> Rule Manager [upgrade] VALID
Miscellaneous Warnings
WARNING: --> Database is using a timezone file older than version 14.
.... After the release migration, it is recommended that DBMS_DST package
.... be used to upgrade the 10.2.0.4.0 database timezone version
.... to the latest version which comes with the new release.
WARNING: --> Database contains INVALID objects prior to upgrade.
.... The list of invalid SYS/SYSTEM objects was written to
.... registry$sys_inv_objs.
.... The list of non-SYS/SYSTEM objects was written to
.... registry$nonsys_inv_objs.
.... Use utluiobj.sql after the upgrade to identify any new invalid
.... objects due to the upgrade.
.... USER PUBLIC has 1 INVALID objects.
WARNING: --> EM Database Control Repository exists in the database.
.... Direct downgrade of EM Database Control is not supported. Refer to the
.... Upgrade Guide for instructions to save the EM data prior to upgrade.
WARNING: --> Your recycle bin is turned on and currently contains no objects.
.... Because it is REQUIRED that the recycle bin be empty prior to upgrading
.... and your recycle bin is turned on, you may need to execute the command:
PURGE DBA_RECYCLEBIN
.... prior to executing your upgrade to confirm the recycle bin is empty.
WARNING: --> JOB_QUEUE_PROCESS value must be updated
.... Your current setting of "10" is too low.
.... Starting with Oracle Database 11g Release 2 (11.2), setting
.... JOB_QUEUE_PROCESSES to 0 causes both DBMS_SCHEDULER and
.... DBMS_JOB jobs to not run. Previously, setting JOB_QUEUE_PROCESSES
.... to 0 caused DBMS_JOB jobs to not run, but DBMS_SCHEDULER jobs were
.... unaffected and would still run. This parameter must be updated to
.... a value greater than 48 (default value is 1000) prior to upgrade.
.... Not doing so will affect the running of utlrp.sql after the upgrade
Recommendations
Oracle recommends gathering dictionary statistics prior to
upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;
Oracle recommends reviewing any defined events prior to upgrading.
To view existing non-default events execute the following commands
while connected AS SYSDBA:
Events:
SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2
WHERE UPPER(name) ='EVENT' AND isdefault='FALSE'
Trace Events:
SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2
WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'
Changes will need to be made in the init.ora or spfile.
SQL> SPOOL OFF
here are the last 100 lines of upgrade.log
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN",
line 276
ORA-06512: at line 1
. JAVA CLASS "ORDSYS"."/...","KGLH0^1182baa5","kglHeapInitialize:temp")
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN_PRV", line 6945
ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN", line 276
ORA-06512: at line 1
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN_PRV", line 6945 ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN", line 276
ORA-06512: at line 1
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN", line 276 ORA-06512: at line 1
. ORA-06512: at line 1
. ORA-53051: no editDataModel session found ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN_PRV", line 6306
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN",
line 125
ORA-06512: at line 14805
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN_PRV", line 6306 ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN", line 125
ORA-06512: at line 14805
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN", line 125 ORA-06512: at line 14805
. ORA-06512: at line 14805
. ORA-53051: no editDataModel session found ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN_PRV", line 6306
ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN",
line 125
ORA-06512: at line 67
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN_PRV", line 6306 ORA-06512: at
"ORDSYS.ORD_DICOM_ADMIN", line 125
ORA-06512: at line 67
. ORA-06512: at "ORDSYS.ORD_DICOM_ADMIN", line 125 ORA-06512: at line 67
. INVALID 11.2.0.4.0 00:55:05
Spatial
. OPTION OFF 10.2.0.4.0 00:00:00
Oracle Expression Filter
. VALID 11.2.0.4.0 00:00:16
Oracle Rules Manager
. VALID 11.2.0.4.0 00:00:14
Final Actions
. 00:01:34
Total Upgrade Time: 01:43:11
PL/SQL procedure successfully completed.
SQL>
SQL> SET SERVEROUTPUT OFF
SQL> SET VERIFY ON
SQL> commit;
Commit complete.
SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL>
SQL> DOC
DOC>#######################################################################
DOC>#######################################################################
DOC>
DOC> The above sql script is the final step of the upgrade. Please
DOC> review any errors in the spool log file. If there are any errors in
DOC> the spool file, consult the Oracle Database Upgrade Guide for
DOC> troubleshooting recommendations.
DOC>
DOC> Next restart for normal operation, and then run utlrp.sql to
DOC> recompile any invalid application objects.
DOC>
DOC> If the source database had an older time zone version prior to
DOC> upgrade, then please run the DBMS_DST package. DBMS_DST will upgrade
DOC> TIMESTAMP WITH TIME ZONE data to use the latest time zone file shipped
DOC> with Oracle.
DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
SQL>
SQL> Rem Set errorlogging off
SQL> SET ERRORLOGGING OFF;
SQL>
SQL> REM END OF CATUPGRD.SQL
SQL>
SQL> REM bug 12337546 - Exit current sqlplus session at end of catupgrd.sql.
SQL> REM This forces user to start a new sqlplus session in order
SQL> REM to connect to the upgraded db.
SQL> exit -
Loading XML file into DB Table
Hi
I m quite new to the loading XML file into database table.
It will be great if anyone could guide me to through.
Now,
i have an XML file which has to be loaded into the DB table.
what are the steps involved in doing this. How do i go from here ??
your help is greatly appriciated ???
Thank you so much!!
-ShashiOK - Although you really should read the XMLDB FAQ on this forum, here is some sample code of ONE of the ways of doing it
(there are multiple ways - and this is not the most simple one)
Based on Oracle 11gR1
-- sqlplus /nolog
clear screen
set termout on
set feed on
set lines 40
set long 10000000
set serveroutput on
set lines 100
set echo on
connect / as sysdba
col filename for a80
col xml for a80
-- Create schema “OTN”
drop user OTN cascade;
purge dba_recyclebin;
create user OTN identified by OTN;
grant dba, xdbadmin to OTN;
EXECUTE dbms_java.grant_permission( 'OTN', 'java.io.FilePermission','G:\OTN\xmlstore','read' );
prompt pause
pause
clear screen
-- Create directory
connect OTN/OTN;
show user
drop directory OTN_USE_CASE;
CREATE directory OTN_USE_CASE AS 'G:\OTN\xmlstore';
SELECT extract((XMLTYPE(bfilename('OTN_USE_CASE','ABANDA-20030407215829881GMT.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
from dual;
prompt pause
pause
clear screen
-- Directory Listing - Tom Kyte
create global temporary table DIR_LIST
( filename varchar2(255) )
on commit delete rows
create or replace
and compile java source named "DirList"
as
import java.io.*;
import java.sql.*;
public class DirList
{public static void getList(String directory)
throws SQLException
{ File path = new File( directory );
String[] list = path.list();
String element;
for(int i = 0; i < list.length; i++)
{ element = list;
#sql { INSERT INTO DIR_LIST (FILENAME)
VALUES (:element) };
create or replace procedure get_dir_list( p_directory in varchar2 )
as language java
name 'DirList.getList( java.lang.String )';
prompt pause
pause
clear screen
-- The content of the global temporary table
exec get_dir_list( 'G:\OTN\xmlstore' );
select * from dir_list;
-- "COMMIT" will clear / truncate the global temporary table...
prompt pause
pause
clear screen
-- Combined: Reading XML content from multiple XML files
commit;
exec get_dir_list( 'G:\OTN\xmlstore' );
select * from dir_list where filename like '%.xml'
and rownum <= 10;
prompt pause
pause
clear screen
select extract((XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
from dir_list dl
where dl.filename like '%.xml' and rownum <= 2;
prompt pause
pause
clear screen
-- If you can select it you can insert it...
-- drop table OTN_xml_store purge;
create table OTN_xml_store of xmltype
xmltype store as binary xml
commit;
exec get_dir_list( 'G:\OTN\xmlstore' );
set time on timing on
insert into OTN_xml_store
select XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) AS "XML"
from dir_list dl
where dl.filename like '%.xml';
set time off timing off
commit;
select count(*) from OTN_xml_store;
prompt pause
pause
clear screen
-- If you can select it you can create resources and files
set time on timing on
commit;
exec get_dir_list( 'G:\OTN\xmlstore' );
select count(*) from dir_list where filename like '%.xml';
set serveroutput on size 10000
DECLARE
XMLdoc XMLType;
res BOOLEAN;
v_foldername varchar2(4000) := '/public/OTN/';
cursor c1
is
select dl.filename FNAME
, XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) XMLCONTENT
from dir_list dl
where dl.filename like '%.xml'
and rownum <= 100;
BEGIN
-- Create XDB repository Folder
if (dbms_xdb.existsResource(v_foldername))
then
dbms_xdb.deleteResource(v_foldername,dbms_xdb.DELETE_RECURSIVE_FORCE);
end if;
res:=DBMS_XDB.createFolder(v_foldername);
-- Create XML files in the XDB Repository
for r1 in c1
loop
if (DBMS_XDB.CREATERESOURCE(v_foldername||r1.fname, r1.xmlcontent))
then
dbms_output.put_line(v_foldername||r1.fname);
null;
else
dbms_output.put_line('Loop Exception :'||sqlerrm);
end if;
end loop;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line('Others Exception: '||sqlerrm);
END;
set time off timing off
commit;
prompt pause
pause
clear screen
-- FTP and HTTP
clear screen
prompt
prompt *** FTP - Demo ***
prompt
prompt pause
pause
host ftp
-- open localhost 2100
-- user OTN OTN
-- cd public
-- cd OTN
-- ls
-- bye
clear screen
prompt
prompt *** Microsoft Internet Explorer - Demo ***
prompt
prompt pause
pause
host "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://OTN:OTN@localhost:8080/public/OTN/
prompt pause
pause
-- Accessing the XDB Repository content via Resource View
-- Selecting content from a resource via XBDUriType
clear screen
prompt set long 300
set long 300
prompt Relative Path - (path)
SELECT path(1) as filename
FROM RESOURCE_VIEW
WHERE under_path(RES, '/public/OTN', 1) = 1
and rownum <= 10
prompt pause
pause
clear screen
prompt Absolute Path - (any_path)
select xdburitype(any_path).getClob() as xml
FROM RESOURCE_VIEW
WHERE under_path(RES, '/public/OTN', 1) = 1
and rownum <= 1;
prompt pause
pause
-- CLEANUP ENVIRONMENT
clear screen
prompt
prompt >>>>> Clean UP !!! <<<<<<
prompt
prompt Cleanup environment and drop user...!!!
prompt
pause
clear screen
conn / as sysdba
alter session set current_schema=OTN;
begin
dbms_xdb.deleteResource('/public/OTN',dbms_xdb.DELETE_RECURSIVE_FORCE);
commit;
end;
alter session set current_schema=sys;
drop user OTN cascade;
Based on http://www.liberidu.com/blog/?p=1053 -
ALL_TAB_COLUMNS table name showing with fancy characters
Dear All
when i execure followowing query and got a table name as BIN$eeHkLT/tL+PgRAAhKBTEWA==$0
select * from all_tab_columns
where column_name like '%APPLICATIONORDER%'
Please let me know what is this and how to select the data from it
thanking youits recycle bin ; please refer to oracle documentation to understand this feature;
see below from oracle documentaion : (http://www.oracle.com/technology/pub/articles/10gdba/week5_10gdba.html)
Managing the Recycle Bin
If the tables are not really dropped in this process--therefore not releasing the tablespace--what happens when the dropped objects take up all of that space?
The answer is simple: that situation does not even arise. When a tablespace is completely filled up with recycle bin data such that the datafiles have to extend to make room for more data, the tablespace is said to be under "space pressure." In that scenario, objects are automatically purged from the recycle bin in a first-in-first-out manner. The dependent objects (such as indexes) are removed before a table is removed.
Similarly, space pressure can occur with user quotas as defined for a particular tablespace. The tablespace may have enough free space, but the user may be running out of his or her allotted portion of it. In such situations, Oracle automatically purges objects belonging to that user in that tablespace.
In addition, there are several ways you can manually control the recycle bin. If you want to purge the specific table named TEST from the recycle bin after its drop, you could issue
PURGE TABLE TEST;
or using its recycle bin name:
PURGE TABLE "BIN$04LhcpndanfgMAAAAAANPw==$0";
This command will remove table TEST and all dependent objects such as indexes, constraints, and so on from the recycle bin, saving some space. If, however, you want to permanently drop an index from the recycle bin, you can do so using:
purge index in_test1_01;
which will remove the index only, leaving the copy of the table in the recycle bin.
Sometimes it might be useful to purge at a higher level. For instance, you may want to purge all the objects in recycle bin in a tablespace USERS. You would issue:
PURGE TABLESPACE USERS;
You may want to purge only the recycle bin for a particular user in that tablespace. This approach could come handy in data warehouse-type environments where users create and drop many transient tables. You could modify the command above to limit the purge to a specific user only:
PURGE TABLESPACE USERS USER SCOTT;
A user such as SCOTT would clear his own recycle bin with
PURGE RECYCLEBIN;
You as a DBA can purge all the objects in any tablespace using
PURGE DBA_RECYCLEBIN;
As you can see, the recycle bin can be managed in a variety of different ways to meet your specific needs.
Maybe you are looking for
-
Hello, I upgraded a app from 4.5 to 10g, where oracle pipes was used to execute OS operation, now i've to replace it with host function, does anyone knows where i can gather some documentation, information with this topics. Please help, it's very urg
-
IPhoto not showing videos in Photo Stream
Does anyone know why I can't see my videos which have transferred from my iPhone to my computer via Photo Stream?
-
Hi all - am trying to figure out how to set up a new iMac at our country property with limited internet service. Don't want to even have a landline (for dial-up, heaven forbid) and cable is not available so want to use an Aircard over an existing AT&
-
I need to learn how to print in Java 1.4 (Printing tutorial needed)
Hi I need to find a really good Printing tutorial. Can anyone tell tell of a good tutorial. Please don't ask my to do a Google search as I have already :) Thanks Craig
-
RoboHelp 7 - unable to Compile
RoboHelp 7 - Microsoft HTML Help - the Compile hangs up when it reaches "Updating topics" stage & only way to exit is to Crtl-Alt-Delete - the "Task Manager" lists two instances of "RoboHelp not responding" . When 1 is highlighted and End Task is se