How to use Recycle bin in SQL
Hi All,
I am using oracle 10g sql plus.
It is not displaying the details of dropped tables in recyclebin.
And also when i give flashback it is showing that object not in recyclebin..
see the below example...
SQL> CREATE TABLE DUM(NAME VARCHAR2(2));
Table created.
SQL> INSERT INTO DUM VALUES ('HI');
1 row created.
SQL> SELECT * FROM DUM;
NA
HI
SQL> DROP TABLE DUM;
Table dropped.
SQL> FLASHBACK TABLE DUM TO BEFORE DROP;
FLASHBACK TABLE DUM TO BEFORE DROP
ERROR at line 1:
ORA-38305: object not in RECYCLE BIN
Hi
This error is due to setting of flash back parameters
u can enable flash back as
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 184549376 bytes
Fixed Size 1300928 bytes
Variable Size 157820480 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter system set DB_FLASHBACK_RETENTION_TARGET=4320;
--4320 min(time)
System altered.
SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=536870912;
System altered.
SQL> alter system set DB_RECOVERY_FILE_DEST='/u02/fra';
System altered. --a recovery file size of 512MB and defined
the location for the file recovery area (FRA) as /u02/fra.
SQL> alter database flashback on;
Database altered.
SQL> alter database open;
Database altered.
oracle@nexus6 ~$ sqlplus ben/passwd
SQL*Plus: Release 10.1.0.2.0 - Production on Thu Nov 4
00:41:36 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 -
Production
With the Partitioning, OLAP and Data Mining options
and u can test now as
1) create a table
2) insert some records
3) and drop the table
then
4)flashback table <table_name> to before drop;
exec it u will get back the table with data
Regards
Hitesh Nirkhey
Similar Messages
-
How to use OEM to moniter sql server 2000
Hi,
I need to learn How to use OEM to moniter sql server 2000.
Can anyone help me and give me some website or documents
to read?
So I can learn to do this job.
Thanks.See Note 115302.1 in Metalink.oracle.com
in how to use OEM Diagnostic pack addon for SQL Server
Or search for
oem "user events"
to build your own monitor script. -
How to disable RECYCLE BIN functionality on Oracle 10g R2
Hi,
I installed Oracle 10g R2 in windows 2003, then log in SQL * plus with sys as sysdba, try to use the following command to disable the RECYCLE BIN functionality which is new feature in Oracle 10g R2.
SQL> alter system set "_RECYCLEBIN"=FALSE SCOPE=BOTH;
I got the error: illegal option for ALTER SYSTEM
What do I miss? any comments are appreciative.
GraceSQL> alter system set recyclebin=off;
System altered.
SQL> alter system set recyclebin=on;
System altered.
SQL>Best regards
Maxim -
How to exclude recycling bin from tablespace usage calculations
I have a generic query to tell me how much of a given tablespace is used. I want to exclude objects in the recycling bin.
in dba_segments these segments all have names that begin with BIN$
This is not the case in dba_extents where we get the calculations from. How do I exclude objects in the recylcing bin? Basically how do I exclude segments in dba_extents that are in the recycling bin
select f.tablespace_name,a.total,
u.used,f.free,
round((u.used/a.total)*100) "% used",
round((f.free/a.total)*100) "% Free",
round(((0.10*u.used)-f.free)/0.9) "10%",
round(((0.15*u.used)-f.free)/0.85) "15%",
round(((0.20*u.used)-f.free)/0.8) "20%",
round(((0.25*u.used)-f.free)/0.75) "25%"
from
(select tablespace_name, sum(bytes/(1024*1024)) total from dba_data_files group by tablespace_name) a,
(select tablespace_name, round(sum(bytes/(1024*1024))) used from dba_extents group by tablespace_name) u,
(select tablespace_name, round(sum(bytes/(1024*1024))) free from dba_free_space group by tablespace_name) f
WHERE a.tablespace_name = f.tablespace_name
and a.tablespace_name = u.tablespace_name
and a.tablespace_name=TRIM(UPPER('&&TS_NAME'))
/You could join the two views or you could use dba_segments rather than extents in your query or you could use the built-in functionality rather than writing your own.
http://www.morganslibrary.org/reference/dbms_space.html
DBMS_SPACE.FREE_BLOCKS
DBMS_SPACE.UNUSED_SPACE -
How to use Java with PL/SQL commands to send an email with attachment
Apologizes in advance if this is the wrong place to ask the question.
I need to use Java with PL/SQL commands to send an email with attachment. My java application runs from the command line and does some magic to gather info from an Oracle 11g db. If the DB has sendmail configured, I'd like to send the results of the data gathering as an attachment to the email addresses. I'm not sure how to do this. I've been reading up on on PL/SQL can send email with UTL_SMTP - with attachments. I'm just not sure how to translate that into being triggered by my Java application. Any suggestions or pointers on what I should read would be appreciated.
Background - I've been programming in Java for 10+ years, but this is my first time using databases. I also have been on these forums for a long time, but lost my profile when it was switched to Oracle.
Thanks for all help.user13726880 wrote:
The original requirements were put together and given to me, an Oracle newbie. They expected the Java app to use something intrinsic to Oracle and Unix sendmail. To solve my problem, I use a JDBC connection to run some SQL commands. I take that data, format it and send the results by email to the user. By default the requirement is to send it as an HTML attachment using Unix 'sendmail'. So I do that using Runtime exec. I have also added JavaMail functionality as an alternative to sendmail. It works great and as expected.Sounds like a reasonable solution.
Note however that PL/SQL itself can send email. And PL/SQL can call unix sendmail too.
However myself I would have done it in java with JavaMail. -
How to use Image field in SQL-7 for curvs
I sampling data from a NI-card. There will be a lot of data so I thought I should use Image-field in SQL-7 to save the hole curve. How do you do that?
I would suggest looking into the Database Connectivity Toolset. It has complete SQL functionality and uses ADO to connect to many types of databases. I have it and it comes with example programs which demonstrate how to write to and read from databases using SQL.
J.R. Allen -
How to use INSERT in EXEC SQL ...... ENDEXEC ?
Hi,
The following code;
DATA: BEGIN OF str_insert,
a(3) TYPE c,
b(3) TYPE c,
END OF str_insert.
EXEC SQL.
SET CONNECTION DEFAULT
ENDEXEC.
str_insert-a = 'a'.
str_insert-b = 'b'.
EXEC SQL.
INSERT INTO ZSAP VALUES :str_insert
ENDEXEC.
The Structure of the ZSAP table (There is no data in ZSAP);
A CHAR 3 (Primary Key)
B CHAR 3
I cannot instert a record to this table it throughs the following error;
Runtime Errors DBIF_DSQL2_SQL_ERROR
Exceptn CX_SY_NATIVE_SQL_ERROR
How could use a structure to insert values into ZSAP?
Thanks,
KishanHello..
loop at T_PC.
loop at T_PCD .
at new NUMREFERENCIA.
exec sql.
INSERT INTO tblPolizaContableR3
(LibroMayor, PeriodoContable, Prefijo, NumReferencia,
Fecha, FuenteDiario, ComentarioPoliza, Moneda,
TipoCambio, RefExternaID1, RefExternaID2, RefExterna1,
RefExterna2, DescRefExterna)
VALUES (:T_PC-LIBROMAYOR, :T_PC-PERIODOCONTABLE,
:T_PC-PREFIJO, :T_PC-NUMREFERENCIA, :T_PC-FECHA,
:T_PC-FUENTEDIARIO, :T_PC-COMENTARIOPLIZA, :T_PC-MONEDA,
:T_PC-TIPOCAMBIO, :T_PC-REFEXTARNAID1, :T_PC-REFEXTERNAID2,
:T_PC-REFEXTERNA1, :T_PC-REFEXTERNA2, :T_PC-DESCREFEXTERNA)
endexec.
endat.
exec sql.
INSERT INTO tblPolizaContableDetR3
(LibroMayor, PeriodoContable, Prefijo, NumReferencia,
Partida, Cuenta, CuentaIMSA, CCostoIMSA,
Cargo, Abono, ComentarioPartida)
VALUES (:T_PCD-LIBROMAYOR, :T_PCD-PERIODOCONTABLE,
:T_PCD-PREFIJO, :T_PCD-NUMREFERENCIA, :T_PCD-PARTIDA,
:T_PCD-CUENTA, :T_PCD-CUENTAIMSA, :T_PCD-CCOSTOIMSA,
:T_PCD-CARGO, :T_PCD-ABONO, :T_PCD-COMENPARTIDA)
endexec.
endloop.
Hope this help you.
Regards, Gustavo Estrada -
How to use parameters in oracle SQL script????
Right now I am writing a SQL script to create a schema and build the objects of this schema....
I use a .net winform program to run sqlplus to parse this sql script ...
The problem is that the schema name and the tablespace's location and the sys password must be input by the user, so my SQL script should use these runtime input parameters instead of const parameters....
So, how to use parameter in SQL script ...........
Are there some example scripts in oracle home directory for me to refer to????Hi,
UNISTD wrote:
thanks .....
what's the difference between variable , define, accept in sqlplus ???VARIABLE declares (but does not assign a value to) a bind variable. Unlike substitution variables, bind variables are passed to the back end to be compiled, and they can only be values in certain data types. You can not use a bind vaiable in place of an identifier, so to do something like
CREATE USER &1 ...a bind variable won't work.
"DEFINE x = y" sets the substitution variable &x to have the value y. There is no user interaction (unless x or y happen to contain undefined substtiution variables).
"DEFINE x" shiows the value of the substitution variable &x, or, if it is undefined, raises a SQL*Plus error. I use this feature below.
ACCEPT sets a substitution variable with user interaction.
And if the user miss some parameters in “sqlplus /nolog ssss.sql par1 par2 par5 par6”, how to use default value of the miss parameters??Don't you need a @ befiore the script name, e.g.
sqlplus /nolog @ssss.sql par1 par2 par5 par6Sorry, I don't know of any good way to use default values.
The foloowing works, but, as you can see, it's ugly.
"DEFINE 1" display a message like
DEFINE 1 = "par1" (CHAR)if &1 is defined; otherwise,it will display a SQL*Plus error message like
SP2-035: symbol 1 is UNDEFINEDNotice that the former contains an '=' sign, but the latter does not.
The best way I know to use default values is to run the DEFINE command, save the output to a filee, read the file, and see if it's an error message or not.
So you can use a script like this:
-- This is DEFINE_DEFAULT.SQL
SPOOL got_define_txt.sql
DEFINE &dd_old
SPOOL OFF
COLUMN dd_new_col NEW_VALUE &dd_new
WITH got_define_txt AS
SELECT q'[
@got_define_txt
]' AS define_txt
FROM dual
SELECT CASE
WHEN define_txt LIKE '%=%'
THEN REGEXP_REPLACE ( define_txt
, '.+"
([^"]*)
, '\1'
ELSE '&dd_default'
END AS dd_new_col
FROM got_define_txt
{code}
and start your real script, ssss.sql, something like this:
{code}
DEFINE dd_new = sv1
DEFINE dd_old = 1
DEFINE dd_default = FOO
@DEFINE_DEFAULT
DEFINE dd_new = sv2
DEFINE dd_old = 2
DEFINE dd_default = "Testing spaces in value"
@DEFINE_DEFAULT
{code}
when this finishes running, the substitution variable &sv1 will either have the value you passed in &1 or, if you didn't pass anything, the default value you specified, that is FOO.
Likewise, &sw2 will have the value you passed, or, if you didn't pass anything, the 23-character string 'Testing spaces in value'.
Here's how it works:
Define_default.sql puts the output of the "DEFINE x" command into a column, define_txt, in a query. That query displays either the existing value of the substitution variable indicated by &dd_old or, if it is undefined, the default value you want to use, which is stored in the substitution variable &dd_default. The substitution variable named in &dd_new is always set to something, but that something may be its existing value.
Notice that the paramerters to define_default.sql must be passed as global varibales.
Why didn't I just use arguments, so that we could simply say:
{code}
@DEFINE_DEFAULT sv1 1 FOO
{code}
? Because that would set the substitution variables &1, &2 and &3, which are miost likely the very ones in which you're interested.
I repeat: there must be a better way, but I'm sorry, I don't know what it is.
I usually don't do the method above. Instead, I always pass the required number of parameters, but I pass dummy or plce-holder values.
For example, if I wanted to call ssss.sql, but use defulat vlaues for &1 and &3, then I would say something like:
{code}
@ssss ? par2 ?
{code}
and, inside ssss.sql, test to see if the values are the place holder '?', and, if so, replace them with some real default value. The use has to remember what the special place holder-value is, but does not need to know anything more, and only ssss.sql itself needs to change if the default values change. -
HT2905 how to empty recycle bin in itunes
How do you empty the recycle bin in itunes
If you have duplicates I'd recommend you read this thread I mentioned in your other thread. It is possible to have duplicates where the same file is referenced twice in the library. If you delete and discard one copy you may find the other no longer works. This is one of the concepts that prompted the development of my DeDuper which should remove duplicates safely.
tt2 -
How to hide Recycling bin and View All Site Content
Is there a way to hide the "View All Site Content" and the "Recycling Bin" without modifying with S Designer.
ThanksHiding these links with CSS is a "band-aid" fix. Users are still downloading the HTML for these controls, and users that don't use CSS will still see them in their entirety. The best option is to remove them from your site's master page entirely.
First, look for the following lines of code in your master page. This code renders the "View All Site Content" link:
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ViewFormPages">
<div class="ms-quicklaunchheader"><SharePoint:SPLinkButton id="idNavLinkViewAll" runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" AccessKey="<%$Resources:wss,quiklnch_allcontent_AK%>"/></div>
</SharePoint:SPSecurityTrimmedControl>
Now, the "Recycle Bin" link should look something like this:
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/recyclebin.aspx" id="idNavLinkRecycleBin" ImageUrl="/_layouts/images/recycbin.gif" Text="<%$Resources:wss,StsDefault_RecycleBin%>" PermissionsString="DeleteListItems"/>
Now save, check in, and publish your changes. I hope this helps!
Kyle -
How to use /usr/bin/gcc with Accelerate?
Hi,
After upgrading Mac to OSX10.9, C compiler has been changed to LLVM.
Using gcc4.9(http://hpc.sourceforge.net), /usr/local/bin/gcc -framework Accelerate xxx.c works well.
Using /usr/bin/gcc, how to compile it with Accelerate?Put the line, #include <Accelerate/Accelerate.h>, in your program,
cc -framework Accelerate xxx.c -
How to use substitution variable in sql
Hai All
I have two tables Rgpmain and Rgpitem the fields are
Rgpmain
unitid,periodid, docno, vendcode ,vendname, part_taken_by and .....
Rgpitem
unitid, periodid, docno, partno, partname .... And i need to give some values in runtime using sub variable
i need to to four values in sub function and i will give one value and i need the result of one variable
The qurey will like this
Select * from rgpmain m, rgpitem i where unitid=1 and periodid=14 and m.unitid=i. unitid and m.periodid= i.periodid and m.docno = i.docno and vendcode ='&p_vendcode'
Or
m.unitid=i. unitid and m.periodid= i.periodid and m.docno = i.docno and vendname like '&p_vendname%'
Or
m.unitid=i. unitid and m.periodid= i.periodid and m.docno = i.docno and partname like '&p_partname%'
or
m.unitid=i. unitid and m.periodid= i.periodid and m.docno = i.docno and partno ='&p_partno'
This is my query
And while i am executing there are four options showing to enter..
My need is i need enter only one field Ie vendcode and execute the vendcode like ABC01 then i need the only
the result that belong to vendcode ABC01 but my query giving all the rows
Pls tell me what is wrong with my query
Thanks In Advance
Srikkanth.MHai
Thanks Man i under stood that nv2 if 1 col is null then it will return 2 col or els 1 col but i working with large
database and i need four or five column using sub. Pls tell whats went wrong with my query when i am executing
one by one at the first time its works fine but next time it returns 1000 rows. pls tell me how to use four or five columns
Regards
srikkanth.M -
[DW 8.02 + PHP] how to use variables in advanced SQL queries
Hi all,
I can't find a way to use variables in an SQL query after
updating
dreamweaver 8.02.
I always get error messages that says: 'missing variable
type:myvariablename', undefined#myvariablename... and so on.
What is the correct way to use variables?
I usually set a variable in a PHP statement (example: <?
$today=date('Y-m-d'); ?>)
and then I compare this variable in the SQL query.
What is the correct syntax for variable in DW 8.02 in
advanced SQL
queries?
TIA
tonysweetman wrote:
> I'm editing a website created with DW 8.01 and MX
Kollection.
>
> I updated DW to 8.02 and now I can't edit an existing
SQL query.
> I always get an error message 'Missing variable type'
and I can't go
> on.
InterAKT released a new version of Kollection to cope with
the 8.0.2
changes. AFAIK, you should be able to download the updated
version from
your InterAKT account area.
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Hi all,
I want to know how to implement algebraic sets in PL/SQl.
I mean for example if there is a table R(A,B) where A is aprimary key having the data :-
{(1,2),(2,1),(2,3),(3,1)}
i want to have a data type that represents sets of data corresponding to attribute B.
i.e the data type should have the value {1,2,3}
Thanks.Not sure that I understand correctly.. and how you want to fit PL/SQL into this.
Sets are best handles as Oracle tables. The best language to deal with sets are SQL. So to get the results you want should be a simple:
SELECT DISTINCT b FROM table_r ORDER BY 1
The results of this can be a cursor that needs to be stepped (fetch) through.
The results can be bulk collected into a dynamic array, e.g.
create or replace type TArray is table of number;
And then in PL/SQL:declare
array TArray;
begin
SELECT DISTINCT b BULK COLLECT INTO array FROM table_r ORDER BY 1;
end;The array object will now contain TArray(1,2,3). -
How to use hints in PL/SQL
Hi,
If I want to use hints in PL/SQL procedure, it is valid to write it this way:
begin
update /*+ INDEX(opp DIM_OPP_REFDB_IDX) */
scott.rec_dim_opportunity opp
set opp.mp_opportunity_re ....
endI doubt when I tried it that the optimizer didn't actually use the index.
Thanks in advance.
Oracle 10g R1
Windows 2003 32-bitthe table is of 90MB and when the UPDATE statement is used in SQL, the explain plan output shows that the index is used.
When I execute it from a procedure, the Current Statement show in TOAD doesn't show that the index is used and the update takes forever. Explain plan of the statement (as show in TOAD) shows that full table scan is being used.
Maybe you are looking for
-
Error while running application in Jdeveloper 11i
Hi All, I am trying to run the ADF sample application in my Jdeveloper 11i... Iam getting the following error: Error: Remote deployment failed #### Cannot run application Application1 due to error deploying to IntegratedWebLogicServer. I tried to ope
-
Problems with Storm 9530 after software update
Greetings, I am new to this forum and hope I am in the right place. After an email prompt from BlackBerry, Yesterday, I updated my software on my Verizon BlackBerry Storm, 9530. Now I have several problems; 1. Voice commands are not being recognized
-
How to hide parent cost center code in the costing LOV
Dear Gurus, I have a very peculiar issue. I want to hide parent cost center code that appears in the costing LOV of employee in the others tab. Can any body help me out on this one? Regards, Muhammad Noman Shafique
-
Says Adobe Flash Player 11 successfully installed but it is NOT!
Hi, I tried to install the Adobe Flash Player 11. It says each time (tried many times) it was successfully installed but it was not. Actually it gets to 50% then stops and sometimes ask me to close Internet Explorer sometimes does not and then when I
-
Corrupted Windows, and F11 Functionality
Hi I have (HP TouchSmart IQ500) with pre-installed windows vista. For some reason, the windows is corrupted and the boot screen kept loading forever. I decieded to make use of the recovery option that appears when starting the computer (F11), but eve