hierarchical sql (part 2) - error: duplicate rows
Following up on my previous question:This hierarchical query has the duplicate in the result set rows:
Select record_id, parentid, name from my_table
connect by parentid = prior record_id
siblings arrested by name;
Thanks for help.
----------
My table has five columns:
rank (number)
score (number)
name (varchar)
record_id (number)
ParentId (number)
A parentid is a record_id at a higher level in the hierarchy.
A parentid is a record_id at a higher level in the hierarchy.
Rank and Score are used to control (tri) each level of the hierarchy.
The data looks like this:
grade - score - name - record_id - parentid
--------------------------------------------------------------------------------
1 - 1 - name1 - 101-0
1 - 2 - name2 - 102-0
1 - 3 - name3 - 103-0
2 - 1 - name4 - 104-101
2 - 2 - name5 - 105-101
2 - 1 - name6 - 106-102
2 - 2 - Marque7 - 107-102
2 - 1 - name8 - 108-103
2 - 2 - name9 - 109-103
Desired results set:
grade - score - name - record_id - parentid
--------------------------------------------------------------------------------
1 - 1 - name1 - 101-0
2 - 1 - name4 - 104-101
2 - 2 - name5 - 105-101
1 - 1 - name2 - 102-0
2 - 1 - name6 - 106-102
2 - 2 - Marque7 - 107-102
1 - 1 - name3 - 103-0
2 - 1 - name8 - 108-103
2 - 2 - name9 - 109-103
Missing the BEGINNING WITH...?
SQL> select record_id, parentid, name
2 from my_table
3 --Added START WITH
4 start with parentid = 0
5 connect by parentid = prior record_id
6 order siblings by name;
RECORD_ID PARENTID NAME
---------- ---------- ----------
101 0 name1
104 101 name4
105 101 name5
102 0 name2
106 102 name6
107 102 name7
103 0 name3
108 103 name8
109 103 name9
9 rows selected.
Tags: Database
Similar Questions
-
Quick question, on the execution of the query of the ff, I do
Select a.column, sum (decode(a.column,'string',1,'etc...')
But when I include a func or procedure, it won't allow me too and that he would give a PL/SQL: SQL statement ignored error and it will compile only if I remove the first a.column as follows
Select sum (decode(a.column,'string',1,'etc...')
Why is it so? And how should it be rewritten to include the select a.column?
Start
Select a.gameid, sum (decode(a.nscores,'Perfect',100,'Excellent',95,'Good',80,'Poor',50) 'scores'
in x,y
Of...
where the...
return x
end myFunc;
Fundamentals of the PL/SQL language
Concerning
Etbin
-
Procedure to update duplicate rows
In a table, I have a few duplicate lines
I can get it through this query: select PARTY_ID from the XXWFS_CUSTOMER_EXT by PARTY_ID group saw County (PARTY_ID) > 1;
Now for the record I got for each duplicate row, I want to update the second row with a specific value... so the duplicate rows that no longer exist
Ex: I went 12 ID, 14, 16, 18 twice each
Now that 12 is twice... I want to update in the second row of 12 with a value of x is the same for other values like 14.16, etc.
How can I write a procedure for this
Thank youHello
In my view, using the single UPDATE statement, we can do.
Please see the example below. Please use it according to your requirement.
SQL> create table test_emp (empno number,ename varchar2(40)); Table created SQL> insert into test_emp values (1,'SURI'); 1 row inserted SQL> insert into test_emp values (1,'SURI'); 1 row inserted SQL> insert into test_emp values (2,'SRINU'); 1 row inserted SQL> insert into test_emp values (2,'SRINU'); 1 row inserted SQL> SELECT * 2 FROM test_emp; EMPNO ENAME ---------- ---------------------------------------- 1 SURI 1 SURI 2 SRINU 2 SRINU SQL> UPDATE test_emp t2 2 SET t2.ename = 'X' 3 WHERE t2.rowid > (SELECT min(t1.rowid) 4 FROM test_emp t1 5 WHERE t1.ename=t2.ename); 2 rows updated SQL> SELECT * 2 FROM test_emp; EMPNO ENAME ---------- ---------------------------------------- 1 SURI 1 X 2 SRINU 2 X SQL>
According to the structure of your table
UPDATE XXWFS_CUSTOMER_EXT x1 SET x1.party_id =
WHERE x1.part_id = 12 AND x1.rowid > (SELECT min(rowid) FROM XXWFS_CUSTOMER_EXT x2 WHERE x2.party_id = x1.party_id); See you soon,.
SuriPublished by: Suri on 14 March 2013 19:32
-
error "duplicate definition of the function.
How can I change the code below to avoid an error?
It gives me an error "duplicate function definition. Of course, I learn fast enough and little error.
thumpy.addEventListerner (MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void {}
var url: String = " " http://www.thumpersf.com '; '.
var req:URLRequest = new URLRequest (url);
navigateToURL (req, "_blank");
}
You are right about the two lines is necessary. One involves the transfer of the event listener with the identification of the function of Manager in it:
humpy.addEventListener (MouseEvent.CLICK, onClick);
and the other is the actual event handler function
function onClick (...
The duplication error will arise when you have two functions sharing the same name...
function onClick (...
function onClick (...
Unfortunately I do not see the history of the display when writing, so I don't know if it is possible that some other functions were duplicated, rather than that which is currently focused on until now.
To answer your original question and rule the entrance/exit or not that code is the problem, change the code as follows:
thumpy.addEventListener (MouseEvent.CLICK, clickThumpy);
function clickThumpy(evt:MouseEvent):void {}
var url: String = ""http://www.thumpersf.com "; "
var req:URLRequest = new URLRequest (url);
navigateToURL (req, "_blank");
}
(Don't sweat short-circuit the code...) If you're new to AS3, it is better to learn it realizing that there are three distinct parts to bond a URL did you watch... you can drive with one hand after completing some experiments using two)
-
widows system error: duplicate name exists on the network
at startup I get the following: Windows system error: duplicate name on exists on the network, how can I get rid of this?
Change the name of your computer? See if this helps: http://support.microsoft.com/kb/295017 - B -.
http://www.officeforlawyers.com | http://www.OneNote-tips.com
Author: Guide to counsel for Microsoft Outlook -
SP2-0642: SQL * more internal error of State 2165
Hello
I was faced with the question with sqlplus suddenly in 11.2.0.3 throw version on solaris 10 OS, it was working fine until today. No changes made on this (11.2.0.3.Q3) oracle home, but new ORACLE HOME installed by Server DBA (shared server) with the Q4 patch.
-bash-3, $2 sqlplus / as sysdba
SP2-0642: SQL * more internal error state 2165, context 4294967295:0:0
Impossible to continue
As explained in metalink note: 396154.1, I set NLS_DATE_FORMAT, but it doesn't seem to work
also, I've checked the timezone as explained in the blog file, but the file timezone.dat does not exist in 11.2.0.3 version and all the files in $ORACLE_HOME/oracore/zoneinfo/have permissions of reading to the dba group
http://arjudba.blogspot.com/2010/07/non-Oracle-user-hits-SP2-0642-or-SP2.html
-bash - $3.2 ls - ltr
30942 total
-rw - r - r - 1 oracle dba readme.txt 6068 7 June 2010
-rw - r - r - 1 oracle dba 31525 June 7, 2010 timezdif.csv
-rw - r - r - 1 oracle dba 351525 Aug 21, 2011 timezone_9.dat
-rw - r - r - 1 oracle dba 302100 August 21, 2011 timezone_8.dat
-rw - r - r - 1 oracle dba 286815 Aug 21, 2011 timezone_7.dat
-rw - r - r - 1 oracle dba 286217 Aug 21, 2011 timezone_6.dat
-rw - r - r - 1 oracle dba 286310 Aug 21, 2011 timezone_5.dat
-rw - r - r - 1 oracle dba 286264 Aug 21, 2011 timezone_4.dat
-rw - r - r - 1 oracle dba 286651 Aug 21, 2011 timezone_3.dat
-rw - r - r - 1 oracle dba 274900 August 21, 2011 timezone_2.dat
-rw - r - r - 1 oracle dba 344448 Aug 21, 2011 timezone_14.dat
-rw - r - r - 1 oracle dba 344425 Aug 21, 2011 timezone_13.dat
-rw - r - r - 1 oracle dba 345024 Aug 21, 2011 timezone_12.dat
-rw - r - r - 1 oracle dba 345356 Aug 21, 2011 timezone_11.dat
-rw - r - r - 1 oracle dba 345637 Aug 21, 2011 timezone_10.dat
-rw - r - r - 1 oracle dba 274427 Aug 21, 2011 timezone_1.dat
-rw - r - r - 1 oracle dba 801410 Aug 21, 2011 timezlrg_9.dat
-rw - r - r - 1 oracle dba 616723 Aug 21, 2011 timezlrg_8.dat
-rw - r - r - 1 oracle dba 601242 Aug 21, 2011 timezlrg_7.dat
-rw - r - r - 1 oracle dba 586750 Aug 21, 2011 timezlrg_6.dat
-rw - r - r - 1 oracle dba 587487 Aug 21, 2011 timezlrg_5.dat
-rw - r - r - 1 oracle dba 531137 Aug 21, 2011 timezlrg_4.dat
-rw - r - r - 1 oracle dba 527717 Aug 21, 2011 timezlrg_3.dat
-rw - r - r - 1 oracle dba 507957 Aug 21, 2011 timezlrg_2.dat
-rw - r - r - 1 oracle dba 791430 Aug 21, 2011 timezlrg_14.dat
-rw - r - r - 1 oracle dba 782475 Aug 21, 2011 timezlrg_13.dat
-rw - r - r - 1 oracle dba 785621 Aug 21, 2011 timezlrg_12.dat
-rw - r - r - 1 oracle dba 787272 Aug 21, 2011 timezlrg_11.dat
-rw - r - r - 1 oracle dba 792894 Aug 21, 2011 timezlrg_10.dat
-rw - r - r - 1 oracle dba 493675 Aug 21, 2011 timezlrg_1.dat
drwxr-xr-x 2 oracle dba 30 Sep 8 05:03 big
drwxr-xr-x 2 oracle dba 30 Sep 8 05:03 little
Please suggest alternatives to troubleshoot
Thank you
Sol.beach thanks for the reply, I'm able to correct the problem. In fact the PATH variable has put in .profile of export PATH = $PATH: $ORACLE_HOME/bin and the value is lower.
-bash-3, $ 2 echo $PATH
/Apps/Oracle/product/9.2.0.8.2009Q4/bin:/usr/ccs/bin:/usr/sbin:/usr/bin:/bin:.:/ bin:/opt/bin:usr/CSS/bin:/usr/ucb:/usr/local/bin:/apps/Oracle/product/11.2.0.3.2014Q3/bin
I changed as export PATH = $ORACLE_HOME/bin: $PATH and now it works fine. It seems to be a problem with the old Oracle Home, also present in the PATH variable before the bin to the current address of Oracle Home Directory.
-bash-3, $ 2 echo $PATH
/Apps/Oracle/product/11.2.0.3.2014Q3/bin:/apps/Oracle/product/9.2.0.8.2009Q4/bin:/usr/ccs/bin:/usr/sbin:/usr/bin:/bin:.:/ bin: / opt/bin: css/usr/bin: / usr/ucb: / usr/local/bin
Concerning
-
separate notice of motion returns duplicate rows; Why and how to prevent?
I have 2 tables with b.SID a.firstname b.blob and b.id a.id.
one can have duplicate rows; b not.
When I do a
Select a2.name, a2.firstname, b.blob from (select distinct a.id, b.SID, a.firstname a) a2, b where a2.id = b.id (+)
I get only unique records.
When I create a view that selects
create view c as select a2.name, a2.firstname, b.blob from (select distinct a.id, b.SID, a.firstname a) a2, b where a2.id = b.id (+)
and I select * c I get duplicate lines.
I don't know what I'm doing wrong here.
Any help?
Hello
Display online ensures that only unique combinations (id, name, first name) table will be used, but the main result set does not include id, so there is no guarantee that the production lines of the main request will be unique.
Some results you get, you should get the same results if you create a view or not. As Paul says, post a test script complete that people who want to help you can to recreate the problem and test their ideas.
-
Hello gurus
We face below question in oracle11g r2 11.2.0.3.0 platform
11 April 2014 14:40:45, 078 [TRACE] SVR-SCH0 [TRAN-FACTORY] ST KEY: [11] com.elitecore.core.commons.util.db.DatabaseInitializationException: java.sql.SQLRecoverableException: IO error: NL Exception has been generated
at com.elitecore.core.commons.util.db.datasource.OracleConnectionDataSource.init(OracleConnectionDataSource.java:103)
at com.elitecore.core.commons.util.db.DBConnectionManager.init(DBConnectionManager.java:264)
at com.elitecore.core.commons.util.db.DBConnectionManager.init(DBConnectionManager.java:203)
at com.elitecore.core.commons.util.db.DBConnectionManager.reInit(DBConnectionManager.java:173)
at com.elitecore.core.commons.utilx.db.TransactionFactory.scan(TransactionFactory.java:93)
to com.elitecore.core.commons.utilx.db.TransactionFactory$ 2.execute(TransactionFactory.java:165)
to com.elitecore.core.serverx.BaseEliteServer$ BaseServerContext$ 2.run(BaseEliteServer.java:378)
to java.util.concurrent.Executors$ RunnableAdapter.call (Executors.java:441)
to java.util.concurrent.FutureTask$ Sync.innerRun (FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
to java.util.concurrent.ScheduledThreadPoolExecutor$ ScheduledFutureTask.access$ 301 (ScheduledThreadPoolExecutor.java:98)
to java.util.concurrent.ScheduledThreadPoolExecutor$ ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:207)
to java.util.concurrent.ThreadPoolExecutor$ Worker.runTask (ThreadPoolExecutor.java:886)
to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLRecoverableException: IO error: NL Exception has been generated
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
to oracle.jdbc.driver.PhysicalConnection. (PhysicalConnection.java:536)
to oracle.jdbc.driver.T4CConnection. (T4CConnection.java:228)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.elitecore.core.commons.util.db.datasource.OracleConnectionDataSource.init(OracleConnectionDataSource.java:98)
... 14 more
Caused by: oracle.net.ns.NetException: NL Exception has been generated
at oracle.net.resolver.AddrResolution.resolveAddrTree(AddrResolution.java:614)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:411)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:678)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:238)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
... 21 more
Please help us
We use this Oracle RAC - URL JDBC
JDBC: thin: @(DESCRIPTION = (ENABLE = BROKEN)
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = x.x.x.1)
(Port = 1521)) (ADDRESS = (PROTOCOL = TCP) (Host = x.x.x.2) (Port = 1521)))
(FAILOVER = ON) (LOAD_BALANCE = on) (CONNECT_DATA = (SERVICE_NAME = orcl)
(FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC)))
Share your suggestions
Thank you
hitgon
As suggested by link below, we added (SERVER = DEDICATED) already in place the URL and it works
http://www.DBA-Oracle.com/bk_nl_exception_connecting_10g_rac_jdbc.htm
JDBC: thin: @(DESCRIPTION = (ENABLE = BROKEN)
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = dbnode1-vip)
(Port = 1521)) ((ADDRESS = (PROTOCOL = TCP) (Host = dbnode2-vip)(Port = 1521)))
(FAILOVER = ON) (LOAD_BALANCE = on) (CONNECT_DATA = (SERVICE_NAME = orcl)(SERVER = DEDICATED)
(FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC)))
anyone please share the same experience or suggestions.
-
How to remove duplicate rows (not exactly duplicate)
Hi I have lines like this in a table emp
ENO ename age
1 25
26 2
3 25
4 26
I don't have repititve enames... (here in this example: A).
If I find something like that I should keep the first line and delete all other lines.
How can I do this?
as unique empowerment of ename... (except for this)Hi Renon,
There are different ways could remove duplicate rows, but Franks solution seems good.
With the help of ID you can get good results in the largest data sets. If you want Nwe minutes remain in the database and all others to delete then make use of eno and not rowid.DELETE FROM emp y WHERE eno != (SELECT Min(eno) FROM emp x WHERE x.NAME = y.NAME GROUP BY NAME)
HTH
SS -
Hello
I have this CTL file as below:
DOWNLOAD THE DATA
INFILE 'PRODUCT_*.csv '.
ADD
IN THE PRODUCT_CONFIG TABLE
"WHEN <>(1:3) and (1:3) <>' 99" and <>' 00, «,» (1:4),
FIELDS ENDED BY ',' POSSIBLY FRAMED BY "" "
TRAILING NULLCOLS
(
PARTNUMBER NULLIF PARTNUMBER = BLANKS,
NULLIF LABEL = BLANKS,
NULLIF SEQUENCE SEQUENCE = BLANKS,
NULLIF DISPLAY_FLAG DISPLAY_FLAG = BLANKS,
BILL_PERIOD NULLIF BILL_PERIOD = BLANKS)
However, I got this error when I run my file:
SQL * Loader-350: error of syntax in line 6.
Expecting "(", found "99".
"WHEN <>(1:3) and (1:3) <>' 99" and <>' 00, «,» (1:4),
How can I change my code to solve this error?Hello
After your data, I created a test table and load the data successfully. See if this example helps you
CREATE TABLE test ( col1 VARCHAR2 (20), col2 VARCHAR2 (30), col3 NUMBER, col4 NUMBER ); load data truncate into table test when ( col1 !='00') and (col1 !='99') FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS (col1 char(20), col2 char(30), col3 integer external, col4 integer external ); {code} Regards
-
Stuck at this part: 3.6 "Duplicate of the primary backup..."
Hi all.
I'm setting up a Data Guard environment. The two 11rg2 Oracle databases are on the same server called gg.oracle.localdomain
I followed this document here: _ http://romain.novalan.fr/wiki/Oracle: _Data_Guard_with_two_single_instance_11gR2_databases #Duplicate_from_the_primary_backup
I'm STUCK at 3.6 duplicate of the primary backup part. I found that this document is incomplete and that it lets just all kinds of things...
I need someone who really knows how to set up a Data - Guard 11 GR 2 2 Database environment.
Here is all of my information to show you all what I did...
hostname gg.oracle.localdomain
Here is information on the primary database.
ID: oradest
echo $ORACLE_HOME
/U03/app/oradest/product/11.2.0/db_dest
echo $ORACLE_SID
destiny
#########################################################################################
Now, I'm going to list all the parameters in the database of the fate which are related to the Data Guard configuration.
SQL > show the fal parameter
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
fal_client string destiny_prim
fal_server string source_sec
SQL > Show parameter dg_broker_config_file1
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
dg_broker_config_file1 string/u03/app/oradest/oradata/desti
NY/dg1db_prim.dat
SQL > Show parameter dg_broker_start
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
dg_broker_start boolean FALSE
SQL > Show parameter log_archive_config
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
string log_archive_config = (destiny_prim, source DG_CONFIG
_sec)
SQL > Show parameter log_archive_dest_1
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
Log_archive_dest_1 string LOCATION = u03/app/oradest/EC
FATE/h_recovery_area/archiv
ELOG = VALID_FOR (ALL_LOGFILES, A).
LL_ROLES) DB_UNIQUE_NAME = desti
ny_prim
SQL > Show parameter log_archive_dest_2
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
chain of LOG_ARCHIVE_DEST_2 SERVICE = source_sec VALID_FOR =)
ONLINE_LOGFILE, PRIMARY_ROLE) D
B_UNIQUE_NAME = source_sec
SQL > Show parameter remote_login_passwordfile
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
Remote_login_passwordfile channel SHARED
SQL > Show parameter name
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
db_file_name_convert chain
fate of string db_name
db_unique_name string destiny_prim
global_names boolean FALSE
instance_name fate of string
lock_name_space string
log_file_name_convert chain
service name string destiny_prim.oracle.localdomain
Here are my files listener.ora and tnsname.ora for the database of PRIM 'DESTINY '...
I don't know if they're just?
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
[oradest@gg admin] $ cat listener.ora
listener.ora # Network Configuration file: /u03/app/oradest/product/11.2.0/db_dest/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP (PORT = 1522))(HOST = gg.oracle.localdomain))
)
SID_LIST_LISTENER2 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = DESTINY. ORACLE. LOCALDOMAIN)
(ORACLE_HOME = u03/app/oradest/product/11.2.0/db_dest)
(SID_NAME = fate)
)
)
ADR_BASE_LISTENER2 = / u03/app/oradest
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
[oradest@gg admin] $ cat tnsnames.ora
SOURCE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gg.oracle.localdomain) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = source.oracle.localdomain)
)
)
DESTINY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP (PORT = 1522))(HOST = gg.oracle.localdomain))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = destiny.oracle.localdomain)
)
)
ORACLONE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gg.oracle.localdomain) (PORT = 1523))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oraclone.oracle.localdomain)
)
)
#######################################################################################
#######################################################################################
Now, I'll list all the parameters in the database oraclone that are related to the Data Guard configuration.
It's the secondary database...
Here is information on the secondary database.
ID: oraclone
echo $ORACLE_HOME
/U05/app/oraclone/product/11.2.0/db_5
echo $ORACLE_SID
oraclone
SQL > show the fal parameter
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
fal_client string orclone_sec
fal_server string destiny_prim
SQL > Show parameter dg_broker_config_file1
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
dg_broker_config_file1 string/u05/app/oraclone/oradata/orac
Lone/dg1db_prim.dat
SQL > Show parameter dg_broker_start
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
dg_broker_start boolean FALSE
SQL > Show parameter log_archive_config
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
string DG_CONFIG = (destiny_prim, oraclo log_archive_config
ne_sec)
SQL > Show parameter log_archive_dest_1
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
Log_archive_dest_1 string LOCATION = / u05/app/oraclone/fla
sh_recovery_area/ORACLONE/arch
ivelog VALID_FOR = (ALL_LOGFILES
ALL_ROLES) DB_UNIQUE_NAME = ora
clone_sec
SQL > Show parameter log_archive_dest_2
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
chain of LOG_ARCHIVE_DEST_2 SERVICE = oraclone_sec VALID_FOR
= (ONLINE_LOGFILE, PRIMARY_ROLE)
DB_UNIQUE_NAME = destiny_prim
SQL > Show parameter remote_login_passwordfile
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
Remote_login_passwordfile channel SHARED
SQL > Show parameter name
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
db_file_name_convert chain
db_name string DESTINY > > > > > > > > > > > > > > > > IS this CORRECT?
db_unique_name string oraclone_sec
global_names boolean FALSE
instance_name string oraclone
lock_name_space string
log_file_name_convert chain
service name string oraclone_sec.oracle.localdomain
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > OK.
The secondary database of Data-Guard is supposed to have the same as the primary database db_name?
Here's the listener.ora and tnsnames.ora on the secondary database...
I don't know if they're just?
[oraclone@gg admin] $ cat listener.ora
listener.ora # Network Configuration file: /u03/app/oradest/product/11.2.0/db_dest/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gg.oracle.localdomain) (PORT = 1523))
)
SID_LIST_LISTENER3 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORACLONE. ORACLE. LOCALDOMAIN)
(ORACLE_HOME = u05/app/oraclone/product/11.2.0/db_5)
(SID_NAME = oraclone)
)
)
ADR_BASE_LISTENER2 = / u05/app/oraclone
[oraclone@gg admin] $ cat tnsnames.ora
SOURCE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gg.oracle.localdomain) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = source.oracle.localdomain)
)
)
DESTINY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP (PORT = 1522))(HOST = gg.oracle.localdomain))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = destiny.oracle.localdomain)
)
)
ORACLONE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gg.oracle.localdomain) (PORT = 1523))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oraclone.oracle.localdomain)
)
)
DESTINY_PRIM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP (PORT = 1522))(HOST = gg.oracle.localdomain))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = destiny_prim.oracle.localdomain)
)
)
I can't do the DESTINY_PRIM do a tnsping!
Now <
I connect to the database 'oraclone', using the oraclone environment, using the source as oraclone rman executable...
I have this "startup nomount" command for the oraclone...
Now <
I have this command by using the environment of oraclone...
RMAN target sys/PWD auxiliary sys/PWD@destiny
Then I AM connected and it is feedback from RMAN...
Recovery Manager: release 11.2.0.1.0 - Production on Mon Aug 25 22:37:44 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: DESTINY (DBID = 2366452012)
connected to the auxiliary database: DESTINY (unassembled)
Ths IS correct?
NOW, I RUN THE DUPLICATE DATABASE COMMAND... AND THAT IS WHAT I HAVE...
RMAN > duplicate target DATABASE for the nofilenamecheck ensure;
From duplicate Db 25 August 14
using the control file of the target instead of recovery catalog database
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID = 54 type device = DISK
content of Script memory:
{
Restore controlfile Eve clone;
}
execution of Script memory
From restoration to 25 August 14
using the ORA_AUX_DISK_1 channel
channel ORA_AUX_DISK_1: from the restore backup set data file
channel ORA_AUX_DISK_1: restore the control file
channel ORA_AUX_DISK_1: reading from the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_ncsnf_TAG20140825T012420_9zol5lqp_.bkp piece
channel ORA_AUX_DISK_1: part handle=/u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_ncsnf_TAG20140825T012420_9zol5lqp_.bkp tag = TAG20140825T012420
channel ORA_AUX_DISK_1: restored the backup part 1
channel ORA_AUX_DISK_1: restoration complete, duration: 00:00:03
output file name=/u05/app/oraclone/oradata/oraclone/control01.ctl
output file name=/u05/app/oraclone/flash_recovery_area/oraclone/control02.ctl
Finished restore at 25 August 14
content of Script memory:
{
SQL clone 'alter database sleep mounting database';
}
execution of Script memory
SQL statement: alter database mount rescue
content of Script memory:
{
the value of newname for tempfile 1 to
"/ u03/app/oradest/oradata/destiny/temp01.dbf";
clone tempfile switch all;
the value of newname for datafile 1 to
"/ u03/app/oradest/oradata/destiny/system01.dbf";
the value of newname for datafile 2 to
"/ u03/app/oradest/oradata/destiny/sysaux01.dbf";
the value of newname for datafile 3 to
"/ u03/app/oradest/oradata/destiny/undotbs01.dbf";
the value of newname for datafile 4 to
"/ u03/app/oradest/oradata/destiny/users01.dbf";
the value of newname for datafile 5 to
"/ u03/app/oradest/oradata/destiny/example01.dbf";
restoration
clone database
;
}
execution of Script memory
executing command: SET NEWNAME
renamed tempfile 1-/u03/app/oradest/oradata/destiny/temp01.dbf in the control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
From restoration to 25 August 14
using the ORA_AUX_DISK_1 channel
channel ORA_AUX_DISK_1: from the restore backup set data file
channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
channel ORA_AUX_DISK_1: restore datafile 00001 to /u03/app/oradest/oradata/destiny/system01.dbf
channel ORA_AUX_DISK_1: restore datafile 00002 to /u03/app/oradest/oradata/destiny/sysaux01.dbf
channel ORA_AUX_DISK_1: restore datafile 00003 to /u03/app/oradest/oradata/destiny/undotbs01.dbf
channel ORA_AUX_DISK_1: restore datafile 00004 in /u03/app/oradest/oradata/destiny/users01.dbf
channel ORA_AUX_DISK_1: restore datafile 00005 to /u03/app/oradest/oradata/destiny/example01.dbf
channel ORA_AUX_DISK_1: reading from the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_nnndf_TAG20140825T012420_9zol44nk_.bkp piece
channel ORA_AUX_DISK_1: ORA-19870: error when restoring the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_nnndf_TAG20140825T012420_9zol44nk_.bkp piece
ORA-19504: cannot create the file ' / u03/app/oradest/oradata/destiny/system01.dbf '.
ORA-27041: could not open the file
Linux-x86_64 error: 13: permission denied
Additional information: 4
switch to the previous backup
channel ORA_AUX_DISK_1: from the restore backup set data file
channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
channel ORA_AUX_DISK_1: restore datafile 00001 to /u03/app/oradest/oradata/destiny/system01.dbf
channel ORA_AUX_DISK_1: restore datafile 00002 to /u03/app/oradest/oradata/destiny/sysaux01.dbf
channel ORA_AUX_DISK_1: restore datafile 00003 to /u03/app/oradest/oradata/destiny/undotbs01.dbf
channel ORA_AUX_DISK_1: restore datafile 00004 in /u03/app/oradest/oradata/destiny/users01.dbf
channel ORA_AUX_DISK_1: restore datafile 00005 to /u03/app/oradest/oradata/destiny/example01.dbf
channel ORA_AUX_DISK_1: reading from the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_nnndf_TAG20140825T005245_9zoj8xy1_.bkp piece
channel ORA_AUX_DISK_1: ORA-19870: error when restoring the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_nnndf_TAG20140825T005245_9zoj8xy1_.bkp piece
ORA-19505: impossible to identify the file ' / u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_nnndf_TAG20140825T005245_9zoj8xy1_.bkp '.
ORA-27037: unable to get file status
Linux-x86_64 error: 2: no such file or directory
Additional information:
switch to the previous backup
channel ORA_AUX_DISK_1: from the restore backup set data file
channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
channel ORA_AUX_DISK_1: restore datafile 00001 to /u03/app/oradest/oradata/destiny/system01.dbf
channel ORA_AUX_DISK_1: restore datafile 00002 to /u03/app/oradest/oradata/destiny/sysaux01.dbf
channel ORA_AUX_DISK_1: restore datafile 00003 to /u03/app/oradest/oradata/destiny/undotbs01.dbf
channel ORA_AUX_DISK_1: restore datafile 00004 in /u03/app/oradest/oradata/destiny/users01.dbf
channel ORA_AUX_DISK_1: restore datafile 00005 to /u03/app/oradest/oradata/destiny/example01.dbf
channel ORA_AUX_DISK_1: reading from the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_nnndf_TAG20140825T004843_9zoj1d0f_.bkp piece
channel ORA_AUX_DISK_1: ORA-19870: error when restoring the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_nnndf_TAG20140825T004843_9zoj1d0f_.bkp piece
ORA-19505: impossible to identify the file ' / u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_25/o1_mf_nnndf_TAG20140825T004843_9zoj1d0f_.bkp '.
ORA-27037: unable to get file status
Linux-x86_64 error: 2: no such file or directory
Additional information:
switch to the previous backup
channel ORA_AUX_DISK_1: from the restore backup set data file
channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
channel ORA_AUX_DISK_1: restore datafile 00001 to /u03/app/oradest/oradata/destiny/system01.dbf
channel ORA_AUX_DISK_1: restore datafile 00002 to /u03/app/oradest/oradata/destiny/sysaux01.dbf
channel ORA_AUX_DISK_1: restore datafile 00003 to /u03/app/oradest/oradata/destiny/undotbs01.dbf
channel ORA_AUX_DISK_1: restore datafile 00004 in /u03/app/oradest/oradata/destiny/users01.dbf
channel ORA_AUX_DISK_1: restore datafile 00005 to /u03/app/oradest/oradata/destiny/example01.dbf
channel ORA_AUX_DISK_1: reading from the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_23/o1_mf_nnndf_TAG20140823T190612_9zl7m6xg_.bkp piece
channel ORA_AUX_DISK_1: ORA-19870: error when restoring the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_23/o1_mf_nnndf_TAG20140823T190612_9zl7m6xg_.bkp piece
ORA-19505: impossible to identify the file ' / u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_23/o1_mf_nnndf_TAG20140823T190612_9zl7m6xg_.bkp '.
ORA-27037: unable to get file status
Linux-x86_64 error: 2: no such file or directory
Additional information:
switch to the previous backup
channel ORA_AUX_DISK_1: from the restore backup set data file
channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
channel ORA_AUX_DISK_1: restore datafile 00001 to /u03/app/oradest/oradata/destiny/system01.dbf
channel ORA_AUX_DISK_1: restore datafile 00002 to /u03/app/oradest/oradata/destiny/sysaux01.dbf
channel ORA_AUX_DISK_1: restore datafile 00003 to /u03/app/oradest/oradata/destiny/undotbs01.dbf
channel ORA_AUX_DISK_1: restore datafile 00004 in /u03/app/oradest/oradata/destiny/users01.dbf
channel ORA_AUX_DISK_1: restore datafile 00005 to /u03/app/oradest/oradata/destiny/example01.dbf
channel ORA_AUX_DISK_1: reading from the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_23/o1_mf_nnndf_TAG20140823T163736_9zkywp8n_.bkp piece
channel ORA_AUX_DISK_1: ORA-19870: error when restoring the backup /u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_23/o1_mf_nnndf_TAG20140823T163736_9zkywp8n_.bkp piece
ORA-19505: impossible to identify the file ' / u03/app/oradest/flash_recovery_area/DESTINY_PRIM/backupset/2014_08_23/o1_mf_nnndf_TAG20140823T163736_9zkywp8n_.bkp '.
ORA-27037: unable to get file status
Linux-x86_64 error: 2: no such file or directory
Additional information:
switch to the previous backup
RMAN-00571: ===========================================================
RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =.
RMAN-00571: ===========================================================
RMAN-03002: failure of Db in dual at 25/08/2014 22:41:11
RMAN-05556: not all data files have backups can be picked up at the compatible SNA
RMAN-03015: an error has occurred in the script stored memory Script
RMAN-06026: some targets not found - abandonment of restoration
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of the file 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
It is as if she is trying to replace the primary database instead of creating the new secondary database...
Help, please...
Hello;
I agree with Hemant. Looks like you have skipped before too much too quickly without doing the reading.
Here are my notes for duplication on the same host, but this is not a duplication of Eve. However it should give you an idea and not on a single host.
http://www.Visi.com/~mseberg/RMAN/create_a_duplicate_database_on_the_same_host.html
Best regards
mseberg
-
need to remove duplicate rows from a table
Hi gurus,
I'm using oracle 11.2.0.3.
SQL > desc osstage. S_EVT_ACT_X;
Name Null? Type
----------------------------------------- -------- ----------------------------
ROW_ID NOT NULL VARCHAR2 (15 CHAR)
LAST_UPD NOT NULL DATE
PAR_ROW_ID NOT NULL VARCHAR2 (15 CHAR)
ATTRIB_17 NUMBER (22.7)
DATE OF ATTRIB_26
ATTRIB_02 VARCHAR2 (100 CHAR)
PROCESS_TIMESTAMP TIMESTAMP (6);
now, when I give the command below, it gives error as someone has disabled the constraint accidentally.
change the table s_evt_act_x S_EVT_ACT_X_P1 enable constraint;
Error from line 3 in order:
change the constraint of table s_evt_act_x activate S_EVT_ACT_X_P1
Error report:
SQL error: ORA-02437: impossible to validate (OSSTAGE. S_EVT_ACT_X_P1) - primary key violated
02437 00000 - "can't validate (s.%s) - primary key violated."
* Cause: attempted to validate a primary key with duplicate values or null
values.
* Action: remove duplicates and nulls before enabling a primary
key.
You can guide me please with this question.
Please see
Script: Remove the duplicate of a Table (Doc ID 31413.1) lines
How to find or remove the duplicate in a Table (Doc ID 1004425.6) lines
-
Hello
I'm writing a sql that shows the total operating for records that has duplicate. Please share any idea to get it.
sample lines:
o/p required:col1 col2 col3 1 A 2 1 A 2 1 A 2 1 B 3 1 B 3 1 C 5 1 D 2 1 D 2
col1 col2 col3 cumulative_tot 1 A 2 2 1 A 2 2 1 A 2 2 1 B 3 5 1 B 3 5 1 C 5 10 1 D 2 12 1 D 2 12
Hello
Try this:
WITH A AS ( select 1 col1, 'A' col2, 2 col3 from dual union all select 1 col1, 'A' col2, 2 col3 from dual union all select 1 col1, 'A' col2, 2 col3 from dual union all select 1 col1, 'B' col2, 3 col3 from dual union all select 1 col1, 'B' col2, 3 col3 from dual union all select 1 col1, 'C' col2, 5 col3 from dual union all select 1 col1, 'D' col2, 2 col3 from dual union all select 1 col1, 'D' col2, 2 col3 from dual ) ,B AS ( SELECT A.* ,ROW_NUMBER() OVER (PARTITION BY COL1, COL2 ORDER BY 1) RN FROM A ) SELECT B.* ,SUM(CASE WHEN RN = 1 THEN COL3 ELSE 0 END) OVER ( ORDER BY COL1, COL2 ,RN ) cumulative_tot FROM B ; COL1 COL2 COL3 RN CUMULATIVE_TOT ---- ---- ---- -- -------------- 1 A 2 1 2 1 A 2 2 2 1 A 2 3 2 1 B 3 1 5 1 B 3 2 5 1 C 5 1 10 1 D 2 1 12 1 D 2 2 12 8 rows selected
Kind regards
Peter
-
the database error duplicate from one server to another server
Hello
I'm practicing duplicate database to a single database server to another server. Path material and pilot on 2 machines is the same. Here are my steps:
-Clone site:
1 change the listener.ora with content:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = CIP)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain) (PORT = 1521))
)
)
ADR_BASE_LISTENER = / u01/app/oracle
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = WE
2. stop and start receiving once again, show message as:
Service "orcl" has 1 instance (s).
Instance "orcl", status UNKNOWN, has 1 operation for this service...
The command completed successfully
3. create pfile from spfile file.
4. stop and startup nomount with pfile is new pfile create in step 3.
--------------------------------------- Source site
1 edit tnsnames.ora with content like:
VVCOREDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = vvcoredb)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.254.1.235) (PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
2 run the command of rman like these:
RMAN > Connect target sys@vvcoredb
RMAN > target password database:
RMAN > Connect auxiliary sys@orcl
RMAN > database auxiliary password:
RMAN > DUPLICATE TARGET DATABASE for database orcl active spfile nofilenamecheck.
Then the result show below:
From Db double to 24-SEP-12
using the control file of the target instead of recovery catalog database
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID = 63 type device = DISK
content of Script memory:
{
backup that copy reuse
TargetFile ' / u01/app/oracle/product/11.2.0/db_1/dbs/spfilevvcoredb.ora' auxiliary format
' / u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora';
clone of SQL 'alter system set spfile = "/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora";
}
execution of Script memory
Backup to starting 24-SEP-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID = 74 type device = DISK
Backup finished 24-SEP-12
SQL statement: alter system set spfile = "/u01/app/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora"
content of Script memory:
{
clone of SQL 'alter system set = db_name
"ORCL" comment =
"reproduce" scope = spfile;
clone to stop immediately;
startup nomount clone;
}
execution of Script memory
SQL statement: alter system db_name set = comment "ORCL" = "duplicate" scope = spfile
Instance Oracle to close
connected to the auxiliary database (not started)
RMAN-00571: ===========================================================
RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =.
RMAN-00571: ===========================================================
RMAN-03002: failure of Db in dual at 24/09/2012 17:44:12
RMAN-03015: an error has occurred in the script stored memory Script
RMAN-04014: failed to start: ORA-01261: parameter db_recovery_file_dest destination string cannot be translated
ORA-01262: Stat failed on a destination of the file directory
Linux-x86_64 error: 2: no such file or directory
I don't know what wrong with my pfile file? I said to correct my pfile site clone like this:
ORCL.__db_cache_size = 1476395008
ORCL.__java_pool_size = 16777216
ORCL.__large_pool_size = 16777216
ORCL.__oracle_base='/U01/app/oracle'#ORACLE_BASE the value of the environment
ORCL.__pga_aggregate_target = 1342177280
ORCL.__sga_target = 1979711488
ORCL.__shared_io_pool_size = 0
ORCL.__shared_pool_size = 436207616
ORCL.__streams_pool_size = 0
*.audit_file_dest='/U01/app/Oracle/admin/ORCL/adump '
* .audit_trail = "db".
* full = '11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/flash_recovery_area/orcl/control02.ctl'
* .db_block_size = 8192
* .db_domain = "
* .db_name = "orcl".
*.db_recovery_file_dest='/U01/app/Oracle/flash_recovery_area/vvcoredb '
* .db_recovery_file_dest_size = 4070572032
*.diagnostic_dest='/U01/app/Oracle '
*. Dispatchers ='(Protocol=TCP) (SERVICE = orclXDB)"
* .memory_target = 3313500160
* .open_cursors = 300
* runoff = 150
* .remote_login_passwordfile = "EXCLUSIVE."
* .undo_tablespace = "UNDOTBS1.
Please suggest me I miss some steps when trying to duplicate database?
Any suggestions are welcome.
Thanks in advance!
P/s: sorry for my bad English.This error is because the location of the controlfile specified in your spfile is not present on your server to clone. Change the location of the parameter cntrolfile in spfil or create the same location on the server.
Published by: Slim on 24 Sep 2012 17:47
-
Hello
I'm looking for help with a hierarchical query.
My table has five columns:
rank (number)
score (number)
name (varchar)
record_id (number)
ParentId (number)
A parentid is a record_id at a higher level in the hierarchy.
Rank and Score are used to control (tri) each level of the hierarchy.
The data looks like this:
grade - score - name - record_id - parentid
----------------------------------------------------------
1 - 1 - name1 - 101-0
1 - 2 - name2 - 102-0
1 - 3 - name3 - 103-0
2 - 1 - name4 - 104-101
2 - 2 - name5 - 105-101
2 - 1 - name6 - 106-102
2 - 2 - Marque7 - 107-102
2 - 1 - name8 - 108-103
2 - 2 - name9 - 109-103
I would like to request to view the data in the following order:
grade - score - name - record_id - parentid
----------------------------------------------------------
1 - 1 - name1 - 101-0
2 - 1 - name4 - 104-101
2 - 2 - name5 - 105-101
1 - 1 - name2 - 102-0
2 - 1 - name6 - 106-102
2 - 2 - Marque7 - 107-102
1 - 1 - name3 - 103-0
2 - 1 - name8 - 108-103
2 - 2 - name9 - 109-103
The simple query to get this sequence of result set is adequate. No need to fill or other characteristics.
Thank you.All the columns in your sample have same agenda, so it is not possible to tell which column you want to sisters of the order. I'll assume by its name:
select * from your_table start with parentid = 0 connect by parentid = prior record_id order siblings by name /
For example:
with sample_table as ( select 1 grade,1 score,'name1' name,101 record_id,0 parentid from dual union all select 1,2,'name2',102,0 from dual union all select 1,3,'name3',103,0 from dual union all select 2,1,'name4',104,101 from dual union all select 2,2,'name5',105,101 from dual union all select 2,1,'name6',106,102 from dual union all select 2,2,'name7',107,102 from dual union all select 2,1,'name8',108,103 from dual union all select 2,2,'name9',109,103 from dual ) select * from sample_table start with parentid = 0 connect by parentid = prior record_id order siblings by name / GRADE SCORE NAME RECORD_ID PARENTID ---------- ---------- ----- ---------- ---------- 1 1 name1 101 0 2 1 name4 104 101 2 2 name5 105 101 1 2 name2 102 0 2 1 name6 106 102 2 2 name7 107 102 1 3 name3 103 0 2 1 name8 108 103 2 2 name9 109 103 9 rows selected. SQL>
SY.
Maybe you are looking for
-
Satellite L505 - WPA2-PSK does not work, but works of WPA - PSK
Hello I have a Satellite L505 and I tried to use WPA2-PSK security to connect to my Netgear DGN2000 router, since I read that only this authentication allows speed Wireless-N, but it does not work. I chose it as the mode to use on the router and Wind
-
Individually control the digital ports
Hello I'm getting a weird behavior when I run the VI attached on my computer out of ports digital test/control individually. I have not tested on real hardware because it is not available at this time. When the code is executed, the output pins are b
-
I need assistance with e/s commands NIDAQmx
Hello users of LabWindows/CVI I'm trying to use LabWindows/CVI to develop a data acquisition application that will use a device USB-6289. I can get a running application that will acquire the data I want. However, I have an annoying problem: the new
-
Failure of the Installation Windows 7 Service Pack 1 x 64 error code 0 x 80073701
Hello, I tried to install on Window 7 Home Premium x 64 SP1 several times today, and all end up with failed with the same error code. (error code 0 x 80073701 - the reference cannot be found). I tried troubleshooting windows update, updated system pr
-
I have a Canon Rebel XS and the trigger works someone told me Cannon has a trade in program.