DIstinct db_name
Hi Need ur help
select DB_NAME,STATUS,START_TIME,END_TIME from rc_rman_status where trunc(START_TIME) = trunc(sysdate) order by DB_NAME;
select distinct(DB_NAME),STATUS,START_TIME,END_TIME from rc_rman_status where trunc(START_TIME) = trunc(sysdate) order by DB_NAME;
need the uniqe db_nmae(not repeated)
Thank you
FYI
SQL> desc rc_rman_status
Name Null? Type
DB_KEY NOT NULL NUMBER
DBINC_KEY NOT NULL NUMBER
DB_NAME NOT NULL VARCHAR2(8)
RECID NOT NULL NUMBER
STAMP NOT NULL NUMBER
RSR_KEY NOT NULL NUMBER
PARENT_KEY NUMBER
SESSION_KEY NUMBER
ROW_TYPE VARCHAR2(33)
ROW_LEVEL NUMBER
OPERATION VARCHAR2(33)
STATUS VARCHAR2(33)
COMMAND_ID VARCHAR2(33)
MBYTES_PROCESSED NOT NULL NUMBER
START_TIME NOT NULL DATE
END_TIME DATE
JOB_KEY NUMBER
INPUT_BYTES NUMBER
OUTPUT_BYTES NUMBER
OPTIMIZED VARCHAR2(3)
OBJECT_TYPE VARCHAR2(80)
SESSION_RECID NUMBER
SESSION_STAMP NUMBER
OUTPUT_DEVICE_TYPE VARCHAR2(17)
Similar Messages
-
Is it possible that my update stats used only correct tables?
Whenever there is a schedule maintenance run I receive a error:
Executing the query "UPDATE STATISTICS [Perf].[PerfHourly_F65954CD35A54..." failed with the following error: "Table 'PerfHourly_F65954CD35A549E886A48E53F148F277' does not exist.". Possible failure reasons: Problems with the query, "ResultSet"
property not set correctly, parameters not set correctly, or connection not established correctly.
Is it possible that my update stats used only correct tables?
ThanksUse below script ...(change if required)
USE [dbname]
go
DECLARE @mytable_id INT
DECLARE @mytable VARCHAR(100)
DECLARE @owner VARCHAR(128)
DECLARE @SQL VARCHAR(256)
SELECT @mytable_id = MIN(object_id)
FROM sys.tables WITH(NOLOCK)
WHERE is_ms_shipped = 0
WHILE @mytable_id IS NOT NULL
BEGIN
SELECT @owner = SCHEMA_NAME(schema_id), @mytable = name
FROM sys.tables
WHERE object_id = @mytable_id
SELECT @SQL = 'UPDATE STATISTICS '+ QUOTENAME(@owner) +'.' + QUOTENAME(@mytable) +' WITH ALL, FULLSCAN;'
Print @SQL
EXEC (@SQL)
SELECT @mytable_id = MIN(object_id)
FROM sys.tables WITH(NOLOCK)
WHERE object_id > @mytable_id
AND is_ms_shipped = 0
END
Or use below for required table only but it will not execute only generate script, make change as per ur requirements:
SELECT X.*,
ISNULL(CASE
WHEN X.[Total Rows]<=1000
THEN
CASE
WHEN [Percent Modified] >=20.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN --20% Small Table Rule'
END
WHEN [Percent Modified] = 100.00
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN --100% No real Stats Rule'
--WHEN X.[Rows Modified] > 1000
--THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN --1000 Rows Modified Rule'
ELSE
CASE
WHEN X.[Total Rows] > 1000000000 --billion rows
THEN CASE
WHEN [Percent Modified] > 0.1
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 1B Big Table Rule'
END
WHEN X.[Total Rows] > 100000000 --hundred million rows
THEN CASE
WHEN [Percent Modified] > 1.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 100M Big Table Rule'
END
WHEN X.[Total Rows] > 10000000 --ten million rows
THEN CASE
WHEN [Percent Modified] > 2.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 10M Big Table Rule'
END
WHEN X.[Total Rows] > 1000000 --million rows
THEN CASE
WHEN [Percent Modified] > 5.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 1M Big Table Rule'
END
WHEN X.[Total Rows] > 100000 --hundred thousand rows
THEN CASE
WHEN [Percent Modified] > 10.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 100K Big Table Rule'
END
WHEN X.[Total Rows] > 10000 --ten thousand rows
THEN CASE
WHEN [Percent Modified] > 20.0
THEN 'UPDATE STATISTICS ' + [Schema Name] + '.' + [Table Name] + ' WITH ALL, FULLSCAN -- 10K Big Table Rule'
END
END
END,'') AS [Statistics SQL]
FROM (
SELECT DISTINCT
DB_NAME() AS [Database],
S.name AS [Schema Name],
T.name AS [Table Name],
I.rowmodctr AS [Rows Modified],
P.rows AS [Total Rows],
CASE
WHEN I.rowmodctr > P.rows
THEN 100
ELSE CONVERT(decimal(8,2),((I.rowmodctr * 1.0) / P.rows * 1.) * 100.0)
END AS [Percent Modified]
FROM
sys.partitions P
INNER JOIN sys.tables T ON P.object_Id = T.object_id
INNER JOIN sys.schemas S ON T.schema_id = S.schema_id
INNER JOIN sysindexes I ON P.object_id = I.id
WHERE P.index_id in (0,1)
AND I.rowmodctr > 0
) X
WHERE [Rows Modified] > 1000
ORDER BY [Rows Modified] DESC
Please click "Propose As Answer"
if a post solves your problem, or "Vote As Helpful" if a post has been useful
to you -
How to find databases registered in recovery catalog!
I want to know how many databases registered in recovery catalog
How can i find it?
Thank you!Log in as your catalog owner and execute select distinct db_name from dbinc; with this you will see all registered databases , In 11G onwards as virtual catalog owner you will only see the databases on which you have been granted access.
Regards
Karan -
SQL Windows Server: 2008 R2
SQL: 2008 R2
Problem: I have following drives on this server, Is there a query that I can run daily which will show us the % full and remaining storage capacity on these drives?
Logs(L)
Data(M)
Tempdb(T)
I would like to run that query on all of my servers to get a daily report.
Thanks for your help.Hi,
1.
EXEC MASTER..xp_fixeddrives
GO
2.
SELECT DISTINCT dovs.logical_volume_name AS LogicalName,
dovs.volume_mount_point AS Drive,
CONVERT(INT,dovs.available_bytes/1048576.0) AS FreeSpaceInMB
FROM sys.master_files mf
CROSS APPLY sys.dm_os_volume_stats(mf.database_id, mf.FILE_ID) dovs
ORDER BY FreeSpaceInMB ASC
GO
3.
SELECT DISTINCT DB_NAME(dovs.database_id) DBName,
mf.physical_name PhysicalFileLocation,
dovs.logical_volume_name AS LogicalName,
dovs.volume_mount_point AS Drive,
CONVERT(INT,dovs.available_bytes/1048576.0) AS FreeSpaceInMB
FROM sys.master_files mf
CROSS APPLY sys.dm_os_volume_stats(mf.database_id, mf.FILE_ID) dovs
ORDER BY FreeSpaceInMB ASC
GO
Hope will help you
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it -
Hi All
I have an unusual issue and wondered if someone could assist. have a table which contains a list of columns which i need to feed into the query. I have written some dynamic SQL as shown:
Declare @KeyString varchar(100)
Declare @SQL1 nvarchar(max)
Set @KeyString=(Select STUFF((SELECT '+' + Attr FROM ave_control.ETL.Source inner JOIN [DM_AVE2].[Reference].[CRKAttr] on client = sourcename COLLATE DATABASE_DEFAULT where Client = 'Brampton' Order by AttrOrder FOR XML PATH('')),1,1,'') AS KeyString)
Set @SQL1 ='WITH CLAIMDATA AS(
Select
DB_NAME() AS DBName,
Convert(Varchar,UK.KMPONO) + ''/'' + Convert(Varchar,UK.KMPOSQ) + ''/'' + Convert(Varchar,UK.KMUGYR) + ''/'' + Convert(Varchar,UK.KMDANO) AS [POLICYREF],
Convert(Varchar,UK.KMPONO) + ''/'' + Convert(Varchar,UK.KMPOSQ) + ''/'' + Convert(Varchar,UK.KMUGYR) + ''/'' + Convert(Varchar,UK.KMDANO) + ''/'' + CONVERT(VarChar,UK.KMCMSQ) AS [CLAIMREF],
left(19000000+KMLODT,4) as [LOSSYEAR],
UK.KMLOCD AS [LOSSCODE],
CASE WHEN KMLOCD = '''' then COALESCE(UC.LOLODS,'''') ELSE UC.LOLODS END AS LOSSDESCRIPTION,
UK.KMEVCD AS [EVENTCODE],
KMCMDS AS [CLAIMDESCRIPTION],
CASE WHEN LEFT(KMCMDS,1) = ''@'' THEN ''Y'' ELSE ''N'' END AS [STATICRESERVEREVIEW],
CASE WHEN UCE.EVEVDS IS NULL then COALESCE(UCE.EVEVDS,'''') ELSE UCE.EVEVDS END AS [EVENTCODEDESCRIPTION]
FROM UKKMREP UK
LEFT JOIN UCLOREP UC ON UK.KMLOCD = UC.LOLOCD
LEFT JOIN UCEVREP UCE ON UK.KMEVCD = UCE.EVEVCD),
COGDATA AS(
SELECT TOP 100 PERCENT
CONVERT(Varchar,POLICY)+''/''+CONVERT(Varchar,CO.SEQ)+''/''+CONVERT(Varchar,CO.[YEAR])+''/''+CONVERT(Varchar,CO.[DEC])+''/''+CONVERT(Varchar,CO.CLAIM) AS [CLAIMREF],
[Type],
SUM(isnull(CO.KCR,0)+isnull(CO.ACR,0)+isnull(CO.[OCR],0)+isnull(CO.[EXP],0)+isnull(Co.[LOC],0)) AS OLR
FROM COG626A CO
Group by CONVERT(Varchar,POLICY)+''/''+CONVERT(Varchar,CO.SEQ)+''/''+CONVERT(Varchar,CO.[YEAR])+''/''+CONVERT(Varchar,CO.[DEC])+''/''+CONVERT(Varchar,CO.CLAIM), [Type]
ORDER BY CLAIMREF
CLAIMRCData AS(
Select distinct
DB_NAME() As DBNAME,
Convert(Varchar,UK.KMPONO) + ''/'' + Convert(Varchar,UK.KMPOSQ) + ''/'' + Convert(Varchar,UK.KMUGYR) + ''/'' + Convert(Varchar,UK.KMDANO) + ''/'' + CONVERT(VarChar,UK.KMCMSQ) AS [CLAIMREF],
Convert(varchar,isnull(pocscd,'''')) as POCSCD,
Convert(varchar,isnull(pomkrf,'''')) AS PMKRF,
Convert(varchar,isnull(poplcd,'''')) AS POPLCD,
Convert(varchar,isnull(poqdfg,'''')) AS POQDFG,
Convert(varchar,isnull(pougty,'''')) AS POUGTY,
Convert(varchar,isnull(pogucd,'''')) AS POGUCD,
Convert(varchar,isnull(kmbhcd,'''')) AS KMBHCD,
Convert(varchar,isnull(kmcccd,'''')) AS KMCCCD,
Convert(varchar,isnull(kmdpdv,'''')) AS KMDPDV,
Convert(varchar,isnull(kmevcd,'''')) AS KMEVCD,
Convert(varchar,isnull(kmimcd,'''')) AS KMIMCD,
Convert(varchar,isnull(kmiycd,'''')) AS KMIYCD,
Convert(varchar,isnull(kmlocd,'''')) AS KMLOCD
from UPPOREP UP Left join UKKMREP UK on UP.POPONO = UK.KMPONO AND UP.POPOSQ = KMPOSQ AND UP.POUGYR = UK.kmugyr AND UP.PODANO = UK.KMDANO)
Select distinct
C1.DBName,
C1.POLICYREF,
C1.CLAIMREF,
C1.LossDescription,
C1.LOSSCODE,
C1.LOSSYEAR,
C1.EventCode,
C1.ClaimDescription,
C1.StaticReserveReview,
C1.EventCodeDescription,'
+ @KeyString + ' AS ClaimKey,
Round(CG1.OLR,2) as [OLR],
CASE WHEN CG1.OLR <> 0 THEN ''OPEN'' ELSE ''CLOSED'' END AS [ClaimStatus]
FROM CLAIMDATA C1
LEFT JOIN COGDATA CG1 on C1.CLAIMREF = CG1.CLAIMREF
LEFT JOIN CLAIMRCData CR on C1.CLAIMREF = CR.CLAIMREF
UNION
Select distinct
C1.DBName,
C1.POLICYREF,
SUBSTRING(CG1.ClaimRef,1,Len(CG1.ClaimRef)-2) + ''/0'',
'''' AS LossDescription,
'''' AS LossCode,
1912 AS LossYear,
'''' AS EventCode,
'''' AS ClaimDescription,
'''' AS StaticReserveReview,
'''' AS EventCodeDescription,'
+ @KeyString + ' AS ClaimKey,
0 AS OLR,
''CLOSED'' AS CLAIMSTATUS
From CLAIMDATA C1
INNER JOIN COGDATA CG1 on C1.CLAIMREF = CG1.CLAIMREF
LEFT JOIN CLAIMRCData CR on C1.CLAIMREF = CR.CLAIMREF
Order by C1.POLICYREF'
Select @SQL1
I always want to output @Keystring using a DFT but depending on the client the Keystring is set to a different group of columns and selects a different set of columns from the CLAIMRCData loop.
I tried inserting it as dynamic SQL as a variable but cannot get it to parse - does anyone know how to achieve this?
Here is the output from the Select @SQL1 which always returns the value I want and if i execute this and change the clientname it successfully returns the right claimkey each time - i.e. another client has 3 columns and these are successfully parsed
- i just dont know how to get it into SSIS. Output as shown:
WITH CLAIMDATA AS(
Select
DB_NAME() AS DBName,
Convert(Varchar,UK.KMPONO) + '/' + Convert(Varchar,UK.KMPOSQ) + '/' + Convert(Varchar,UK.KMUGYR) + '/' + Convert(Varchar,UK.KMDANO) AS [POLICYREF],
Convert(Varchar,UK.KMPONO) + '/' + Convert(Varchar,UK.KMPOSQ) + '/' + Convert(Varchar,UK.KMUGYR) + '/' + Convert(Varchar,UK.KMDANO) + '/' + CONVERT(VarChar,UK.KMCMSQ) AS [CLAIMREF],
left(19000000+KMLODT,4) as [LOSSYEAR],
UK.KMLOCD AS [LOSSCODE],
CASE WHEN KMLOCD = '' then COALESCE(UC.LOLODS,'') ELSE UC.LOLODS END AS LOSSDESCRIPTION,
UK.KMEVCD AS [EVENTCODE],
KMCMDS AS [CLAIMDESCRIPTION],
CASE WHEN LEFT(KMCMDS,1) = '@' THEN 'Y' ELSE 'N' END AS [STATICRESERVEREVIEW],
CASE WHEN UCE.EVEVDS IS NULL then COALESCE(UCE.EVEVDS,'') ELSE UCE.EVEVDS END AS [EVENTCODEDESCRIPTION]
FROM UKKMREP UK
LEFT JOIN UCLOREP UC ON UK.KMLOCD = UC.LOLOCD
LEFT JOIN UCEVREP UCE ON UK.KMEVCD = UCE.EVEVCD),
COGDATA AS(
SELECT TOP 100 PERCENT
CONVERT(Varchar,POLICY)+'/'+CONVERT(Varchar,CO.SEQ)+'/'+CONVERT(Varchar,CO.[YEAR])+'/'+CONVERT(Varchar,CO.[DEC])+'/'+CONVERT(Varchar,CO.CLAIM) AS [CLAIMREF],
[Type],
SUM(isnull(CO.KCR,0)+isnull(CO.ACR,0)+isnull(CO.[OCR],0)+isnull(CO.[EXP],0)+isnull(Co.[LOC],0)) AS OLR
FROM COG626A CO
Group by CONVERT(Varchar,POLICY)+'/'+CONVERT(Varchar,CO.SEQ)+'/'+CONVERT(Varchar,CO.[YEAR])+'/'+CONVERT(Varchar,CO.[DEC])+'/'+CONVERT(Varchar,CO.CLAIM), [Type]
ORDER BY CLAIMREF
CLAIMRCData AS(
Select distinct
DB_NAME() As DBNAME,
Convert(Varchar,UK.KMPONO) + '/' + Convert(Varchar,UK.KMPOSQ) + '/' + Convert(Varchar,UK.KMUGYR) + '/' + Convert(Varchar,UK.KMDANO) + '/' + CONVERT(VarChar,UK.KMCMSQ) AS [CLAIMREF],
Convert(varchar,isnull(pocscd,'')) as POCSCD,
Convert(varchar,isnull(pomkrf,'')) AS PMKRF,
Convert(varchar,isnull(poplcd,'')) AS POPLCD,
Convert(varchar,isnull(poqdfg,'')) AS POQDFG,
Convert(varchar,isnull(pougty,'')) AS POUGTY,
Convert(varchar,isnull(pogucd,'')) AS POGUCD,
Convert(varchar,isnull(kmbhcd,'')) AS KMBHCD,
Convert(varchar,isnull(kmcccd,'')) AS KMCCCD,
Convert(varchar,isnull(kmdpdv,'')) AS KMDPDV,
Convert(varchar,isnull(kmevcd,'')) AS KMEVCD,
Convert(varchar,isnull(kmimcd,'')) AS KMIMCD,
Convert(varchar,isnull(kmiycd,'')) AS KMIYCD,
Convert(varchar,isnull(kmlocd,'')) AS KMLOCD
from UPPOREP UP Left join UKKMREP UK on UP.POPONO = UK.KMPONO AND UP.POPOSQ = KMPOSQ AND UP.POUGYR = UK.kmugyr AND UP.PODANO = UK.KMDANO)
Select distinct
C1.DBName,
C1.POLICYREF,
C1.CLAIMREF,
C1.LossDescription,
C1.LOSSCODE,
C1.LOSSYEAR,
C1.EventCode,
C1.ClaimDescription,
C1.StaticReserveReview,
C1.EventCodeDescription,pogucd+pougty AS ClaimKey,
Round(CG1.OLR,2) as [OLR],
CASE WHEN CG1.OLR <> 0 THEN 'OPEN' ELSE 'CLOSED' END AS [ClaimStatus]
FROM CLAIMDATA C1
LEFT JOIN COGDATA CG1 on C1.CLAIMREF = CG1.CLAIMREF
LEFT JOIN CLAIMRCData CR on C1.CLAIMREF = CR.CLAIMREF
UNION
Select distinct
C1.DBName,
C1.POLICYREF,
SUBSTRING(CG1.ClaimRef,1,Len(CG1.ClaimRef)-2) + '/0',
'' AS LossDescription,
'' AS LossCode,
1912 AS LossYear,
'' AS EventCode,
'' AS ClaimDescription,
'' AS StaticReserveReview,
'' AS EventCodeDescription,pogucd+pougty AS ClaimKey,
0 AS OLR,
'CLOSED' AS CLAIMSTATUS
From CLAIMDATA C1
INNER JOIN COGDATA CG1 on C1.CLAIMREF = CG1.CLAIMREF
LEFT JOIN CLAIMRCData CR on C1.CLAIMREF = CR.CLAIMREF
Order by C1.POLICYREF
any help would be greatly appreciated - oh version is SQL 2014 SSIS
Thanks
JamesWhen you say not able to parse, can you give the expression itself?
And in what SSIS component do you run this query?
And what error do you get?
My cursory look (too much code to digest frankly) says you need to wrap it into a stored procedure.
Arthur
MyBlog
Twitter -
Query help in select Distinct on one column.
CREATE GLOBAL TEMPORARY TABLE Table1 (
ID1 varchar2(100) ,
Name1 varchar2(100),
Name11 varchar2(100)
insert into Table1 values ('a','n1','h3');
insert into Table1 values('b','n2','h2');
insert into Table1 values('a','n3','h1');
insert into Table1 values('c','n4','h5');
insert into Table1 values ('c','n5','h4');
insert into Table1 values('d','n6','h6');
select * from Table1;
ID1,NAME1, NAME11
a, n1, h3
b, n2, h2
a, n3, h1
c, n4, h5
c, n5, h4
d, n6, h6
I am trying to select distinct ID1 and all values associated with it which is max row.I want to result as -
ID1,NAME1, NAME11
a, n3, h1
b, n2, h2
c, n5, h4
d, n6, h6
Can you please help me to write simple query to get above result.
Edited by: 871447 on Jul 25, 2011 9:42 AM
Edited by: 871447 on Jul 25, 2011 9:45 AMHi,
Do a self-join, to combine the two rows for each value of id1 onto one output row.
Make it an outer join, in case there is only one row with a vlaue for id1.
SELECT l.id1
, l.name1
, NVL ( r.name11
, l.name11
) AS name11
FROM table1 l
LEFT OUTER JOIN table1 r ON l.id1 = r.id1
AND l.name1 < r.name1
;Edited by: Frank Kulash on Jul 25, 2011 12:57 PM
Sorry, I mis-read the problem.
Lee's solution, above, assumes that name1 is unique, as it is in your sample data.
What output would you want if that's not the case?
If name1 is not unique, but the combination of (id1, name1) is unique, then you can modify Lee's solution like this:
SELECT *
FROM table1
WHERE (id1, name1) IN (
SELECT id1
, MAX (name1)
FROM table1
GROUP BY id1
;Or, if you can't make any assumptions about uniqueness, you might need something like this:
WITH got_r_num AS
SELECT id1, name1, name11
, ROW_NUMBER () OVER ( PARTITION BY id1
ORDER BY name1 DESC
, name11 DESC
) AS r_num
FROM table1
SELECT id1, name1, name11
FROM got_r_num
WHERE r_num = 1
; -
Because of the discussion present in the following thread, I did few experiments and would you like to share with you. Hope it is a useful information for you guys.
Re: db_name & memory allocation
OS: Win XP SP2 or Windows 2000 <b>(32-bit)</b>
Oracle Version: Oracle 10gR2
System RAM: 1G
<b>Attempting to create the database CCC by specifying db_name parameter only</b>
C:\oracle\product\10.2.0\db_1\database>copy con initCCC.ora
db_name=CCC
^Z
1 file(s) copied.
<b> Starting the service </b>
C:\oracle\product\10.2.0\db_1\database>oradim -new -sid CCC -startmode m
Instance created.
C:\oracle\product\10.2.0\db_1\database>set oracle_sid=CCC
C:\oracle\product\10.2.0\db_1\database>sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Apr 6 07:50:06 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
SQL>
SQL> startup nomount
ORACLE instance started.
Total System Global Area <b>113246208</b> bytes -- Default SGA size
Fixed Size 1247588 bytes
Variable Size 58721948 bytes
Database Buffers 50331648 bytes
Redo Buffers 2945024 bytes
<b> On seeing dynamic components size, shared pool got
33m, large pool got 0m, java pool got 25m and buffer cache
got 50m. Please check the references for these default
values. </b>
SQL> select component,current_size from v$sga_dynamic_components;
COMPONENT CURRENT_SIZE
shared pool 33554432
large pool 0
java pool 25165824
streams pool 0
DEFAULT buffer cache 50331648
KEEP buffer cache 0
RECYCLE buffer cache 0
DEFAULT 2K buffer cache 0
DEFAULT 4K buffer cache 0
DEFAULT 8K buffer cache 0
DEFAULT 16K buffer cache 0
COMPONENT CURRENT_SIZE
DEFAULT 32K buffer cache 0
ASM Buffer Cache 0
13 rows selected.
<b>Total=109051904 </b>
SQL>
create database
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
<b>Errors in alert log file</b>
ORA-00604: error occurred at recursive SQL level 1
<b>ORA-04031: unable to allocate 40 bytes of shared memory ("shared pool","create unique index
i_proxy_...","sql area","kksol : kksnsg")
</b>
Error 1519 happened during db open, shutting down database
USER: terminating instance due to error 1519
<b>It was thought that shared_pool memory area is not
sufficient. Then thought to know how oracle will behave on
setting sga_target parameter.</b>
<b>initCCC.ora</b>
db_name=CCC
sga_target=113m
SQL> startup nomount
ORACLE instance started.
Total System Global Area <b>121634816 bytes -- Got around 121m </b>
Fixed Size 1247636 bytes
Variable Size 54527596 bytes
Database Buffers 62914560 bytes
Redo Buffers 2945024 bytes
<b>Now create database statement got success here.
Instance got few extra Mbs of memory and oracle can create
the database.</b>
<b>Then it was thought that, why to give 121Mb even. Let exactly 113246208 bytes be devoted to the instance.</b>
initCCC.ora
db_name=CCC
sga_target=113246208 -- providing exact number of bytes as obtained in default case
SQL> startup nomount
ORACLE instance started.
Total System Global Area 113246208 bytes
Fixed Size 1247588 bytes
Variable Size 54527644 bytes
Database Buffers 54525952 bytes
Redo Buffers 2945024 bytes
SQL>
<b> Now create database statement got success here as
well. Because of sga_target, automatic shared memory
management enabled and instance was taking care of buffer
cache, shared pool, large pool, java pool and
streams_pool. In this case shared pool got 46m (greater
than default case value). Java pool and Large pool got 4
mb each and buffer cache got 54m. </b>
SQL> select component,current_size
2 from v$sga_dynamic_components;
COMPONENT CURRENT_SIZE
shared pool 46137344
large pool 4194304
java pool 4194304
streams pool 0
DEFAULT buffer cache 54525952
KEEP buffer cache 0
RECYCLE buffer cache 0
DEFAULT 2K buffer cache 0
DEFAULT 4K buffer cache 0
DEFAULT 8K buffer cache 0
DEFAULT 16K buffer cache 0
COMPONENT CURRENT_SIZE
DEFAULT 32K buffer cache 0
ASM Buffer Cache 0
13 rows selected.
<b>Total=109051904 </b>
SQL>
By providing 113246208 bytes (as in default case) of
memory to SGA by setting sga_target value, Oracle gave
extra memory to shared_pool and buffer cache than in case
of default, thus helping create database statement to get
pass. Oracle always recommends to use automatic shared
memory management by setting sga_target parameter value.
Hope this experiment provides few clues about automatic
shared memory management feature of Oracle 10g. This case
was conducted on 32-bit Oracle. It is quite possible that
create database statement might get success in 64-bit
Platform as by default Oracle will provide 84 Mb to Shared
pool. But to confirm, it has to be experimented.
References:
Shared pool
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams196.htm#sthref804
Large Pool
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams090.htm#sthref377
Java Pool
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams087.htm#sthref364
Buffer Cache
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams043.htm#sthref185Hi,
Good Work Mohammed !!!
Regards
Taj -
No distinction between NULL and space
No distinction between NULL and space. When you see the resultset, in PL/SQL developer, you will see that the NULL value is in yellow colour while column data having spaces is in white colour. In the new tool, there is not distinction between the two, so each time we will have to use the NVL function to determine the value in the column, which I would not like to do.
An option in Preferences could be created, so that it was possible to choose as values NULL would be shown, as already it occurs in other tools.
-
So when I enter:
SELECT opened_by from(
SELECT ps."NUMBER",
ps.opened_by,
ps.assignee_name,
ps.closed_by,
listagg(att.type,',') within group(order by att.type) actions,
listagg(att.description_txt,',') within group (order by att.description_txt) descs
from tableps ps
LEFT JOIN activity_txt att ON ps."NUMBER" = att."NUMBER" and att.type in('Assignment','Reassignment')
where open_time between to_date('01-OCT-2012','DD-MON-YYYY') and to_date('31-OCT-2013','DD-MON-YYYY')
and ((ps.opened_by=ps.closed_by) and (ps.closed_by=ps.assignee_name) and (ps.assignee_name=ps.opened_by))
group by ps."NUMBER",ps.opened_by,ps.assignee_name,ps.closed_by
where (actions not like '%Reass%'or actions is null)
and (descs like ('%NONE to '|| opened_by ||'%') or descs is null)
and (descs not like '%,%' or descs is NULL);
All is well in the world...however when I add distinct to the outer select I get the
ORA-01489: result of string concatenation is too long
01489. 00000 - "result of string concatenation is too long"
*Cause: String concatenation result is more than the maximum size.
*Action: Make sure that the result is less than the maximum size.
I don't understand the difference why one would work and one doesn't.I little changed your quesry,
Please try, if you are getting same error, then it means you have very large desciptions in description_txt column.
Pleasech check :
https://forums.oracle.com/thread/2596075
https://forums.oracle.com/message/10601105#10601105
SELECT T."NUMBER",
T.opened_by,
T.assignee_name,
T.closed_by,
listagg(T.type,',') within GROUP(ORDER BY T.type) actions,
listagg(T.description_txt,',') within GROUP (ORDER BY T.description_txt) descs
FROM
(SELECT
ps."NUMBER",
ps.opened_by,
ps.assignee_name,
ps.closed_by,att.type, att.description_txt
FROM tableps ps LEFT JOIN activity_txt att ON ps."NUMBER" = att."NUMBER" AND att.type IN('Assignment','Reassignment')
WHERE open_time BETWEEN to_date('01-OCT-2012','DD-MON-YYYY') AND to_date('31-OCT-2013','DD-MON-YYYY')
AND ((ps.opened_by =ps.closed_by)
AND (ps.closed_by =ps.assignee_name)
AND (ps.assignee_name=ps.opened_by))
and (att.type NOT LIKE '%Reass%' OR att.type IS NULL)
AND (att.description_txt LIKE ('%NONE to '|| opened_by ||'%') OR att.description_txt IS NULL)
AND (att.description_txt NOT LIKE '%,%'OR att.description_txt IS NULL)) T
Group by T."NUMBER",
T.opened_by,
T.assignee_name,
T.closed_by
And carefully read Solomon Yakobson's and Frank Kulash's replies.
Regards
Mahir M. Quluzade -
Removing the Duplicate Values from output without using Keyword DISTINCT
Hi,
I'm running the below query without DISTINCT Keyword and getting Duplicate results. can you please tell me what needs to be done if I want unique values without using Distinct.
select hra.Location_code
,hra.Description
,hra.Address_line_1
,hra.Address_line_2
,hra.Address_line_3
,hra.town_or_city
,hra.Region_1
,hra.Postal_Code
,hra.country
,hra.attribute1
,hra.attribute5
,hra.attribute6
,hra.attribute8
,hra.attribute9
,hra.attribute2
,hra.attribute3
,hra.attribute4
,hra.attribute7
,hra.attribute10
from hr_locations_all hra
,per_all_people_f papf
,per_person_types ppt
, per_person_type_usages_f pptuf
,hr_all_organization_units haou
,hr_all_organization_units haou1
where 1=1
and hra.business_group_id = papf.business_group_id
and hra.business_group_id = ppt.business_group_id
and pptuf.person_id = papf.person_id
and pptuf.person_type_id = ppt.person_type_id
and ppt.system_person_type = 'EMP'
and ((hra.inactive_date is null) or (trunc(hra.inactive_date)>= to_date('01/01/2012','mm/dd/yyyy')))
and to_date('01/01/2012','mm/dd/yyyy') between trunc(pptuf.effective_start_date) and trunc(pptuf.effective_end_date)
and((papf.effective_end_date is null) or (trunc(papf.effective_end_date)>= to_date('01/01/2012','mm/dd/yyyy')))
and ((haou1.date_to is null) or (trunc(haou1.date_to)>= to_date('01/01/2012','mm/dd/yyyy')))
and papf.business_group_id = haou.organization_id
and hra.location_id = haou1.location_id;Hi,
Try using this Code
select hra.Location_code
,hra.Description
,hra.Address_line_1
,hra.Address_line_2
,hra.Address_line_3
,hra.town_or_city
,hra.Region_1
,hra.Postal_Code
,hra.country
,hra.attribute1
,hra.attribute5
,hra.attribute6
,hra.attribute8
,hra.attribute9
,hra.attribute2
,hra.attribute3
,hra.attribute4
,hra.attribute7
,hra.attribute10
from hr_locations_all hra
,per_all_people_f papf,
per_all_assignments_f paaf,
per_person_types ppt
, per_person_type_usages_f pptuf
,hr_all_organization_units haou
--,hr_all_organization_units haou1
where 1=1
and
hra.business_group_id = papf.business_group_id
and hra.business_group_id = ppt.business_group_id
and pptuf.person_id = papf.person_id
and papf.person_id=paaf.person_id
and pptuf.person_type_id = ppt.person_type_id
and ppt.system_person_type = 'EMP'
--and ((hra.inactive_date is null) or (trunc(hra.inactive_date)>= to_date('01/01/2012','mm/dd/yyyy')))
and to_date('01/01/2012','mm/dd/yyyy') between trunc(pptuf.effective_start_date) and trunc(pptuf.effective_end_date)
--and((papf.effective_end_date is null) or (trunc(papf.effective_end_date)>= to_date('01/01/2012','mm/dd/yyyy')))
--and((paaf.effective_end_date is null) or (trunc(paaf.effective_end_date)>= to_date('01/01/2012','mm/dd/yyyy')))
and to_date('01/01/2012','mm/dd/yyyy') between trunc(papf.effective_start_date) and trunc(papf.effective_end_date)
and to_date('01/01/2012','mm/dd/yyyy') between trunc(paaf.effective_start_date) and trunc(paaf.effective_end_date)
--and ((haou1.date_to is null) or (trunc(haou1.date_to)>= to_date('01/01/2012','mm/dd/yyyy')))
--and papf.business_group_id = haou.organization_id
and paaf.location_id=hra.location_id
and paaf.organization_id=haou.organization_id
--and papf.employee_number='1010008830'
and hra.location_id = haou.location_id; -
How to get distinct values from a list and display in a ListView webpart.
Hi,
I have a requirement in which I need to pull unique/distinct values from a custom list and then display it via a listview webpart. Can any one suggest how this can be done.
If possible please share the CAMEL query to fetch distinct values from a custom list.
Thanks,
AnkitHi Ankit,
Is there any particular reason that the values need to be shown in a list view web part? Are you going to use that web part for filtering via web part connections?
I ask because the enterprise site collection features include the SharePoint List Filter web part, which may accomplish what you're looking for.
If you just need to display the values in a grid view, you might have more luck with the JavaScript Client Object Model. Try putting the following in a text file:
<style>
.CustomTableClass{display:table;table-layout:fixed}
.CustomRowClass{display:table-row;}
</style>
<div id="distinct_values_div" class="CustomTableClass">
<img src="/_layouts/loading.gif" />
</div>
<script language="JavaScript" type="text/JavaScript">
var siteUrl = '/sitecollection/web'; //use the actual subsite URL here
var listName = 'mylist'; // use the actual list name here
var field = "Title" // use the actual field you want to display here
var divToUpdate = document.getElementById("distinct_values_div");
var rowClass = "CustomRowClass";
ExecuteOrDelayUntilScriptLoaded(function(){
var clientContext = new SP.ClientContext(siteUrl);
var web = clientContext.get_web();
var lists = web.get_lists();
var list = lists.getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query></Query><RowLimit>500</RowLimit></View>');
this.collListItem = list.getItems(camlQuery);
clientContext.load(collListItem,"Include ("+field+")");
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed));
},"sp.js");
function onQueryFailed(sender, args){
divToUpdate.innerHTML = 'Unable to retrieve values: '+args.get_message());
function onQuerySucceeded(sender, args){
var allValues = [];
var listItemEnumerator = collListItem.getEnumerator();
divToUpdate.innerHTML = "";
while(listItemEnumerator.moveNext()){
var listItem = listItemEnumerator.get_current();
if(!containsString(allValues,listItem.get_item(field)){
var value = listItem.get_item(field);
allValues.push(value);
var newDiv = document.createElement("div");
newDiv.className = rowClass;
newDiv.innerHTML = value;
divToUpdate.appendChild(newDiv);
function containsString(strArray, text){
var contains = false;
for (var i=0; i<strArray.length; i++){
if(strArray[i]==text){contains = true; break;}
return contains;
</script>
Upload the text file to a library on the site, then add a content editor web part to a page where you want the distinct values to appear. In the content editor web part's properties, edit the Content Link so that it links directly to the text file. This
will cause the JavaScript to run on the page. -
Get distinct values from a coma seperated string variable
Hi ,
I am getting an comma seperated string as in parameter, now i want to get the distinct values from that string and will use those values to pass it to a query.
any helptry this:
sorry about the messiness - it's just quickly copied from some badly formatted code....
TYPE T_FieldArray IS TABLE OF varchar2(255) INDEX BY BINARY_INTEGER;
function SPLIT_CSV_FIELDS (
p_Input_Str in varchar2,
p_Delimiter in varchar2,
p_Quote_Char in varchar2)
return t_fieldarray is
v_FieldArray T_FieldArray;
v_input_str varchar2(4000);
v_field_str varchar2(255);
v_pos number;
e number := 0;
v_delim_str varchar2(3);
cur_pos number;
begin
loop
-- find each delimiter char in string
v_pos := INSTR(v_input_str, p_Delimiter);
-- each time delimiter char is found
if v_pos > 0 then
-- current field value is current string to position prior to delimiter char
v_field_str := UPPER(SUBSTR(v_input_str, 1, v_pos - 1));
-- remove quote char from end of field (if any)
v_field_str := TRIM(TRANSLATE(v_field_str, NVL(p_Quote_Char, p_Delimiter), ' '));
-- increment element number
e := e + 1;
-- get remainder of input string to check
v_input_str := SUBSTR(v_input_str, v_pos + 1, LENGTH(v_input_str) - v_pos);
v_FieldArray(e) := v_field_str;
else
-- increment element number
e := e + 1;
-- last field value is what's left of input string less quote char (if any)
v_field_str := TRIM(TRANSLATE(UPPER(v_input_str), NVL(p_Quote_Char, p_Delimiter), ' '));
v_FieldArray(e) := v_field_str;
exit;
end if;
end loop;
return v_FieldArray;
end; -
"How to get distinct values of sharepoint column using SSRS"
Hi,
I have integrated sharepoint list data to SQL Server reporting services. I am using the below to query sharepoint list data using sql reporting services.
<Query>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
<Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
<Parameters>
<Parameter Name="listName">
<DefaultValue>{GUID of list}</DefaultValue>
</Parameter>
<Parameter Name="viewName">
<DefaultValue>{GUID of listview}</DefaultValue>
</Parameter>
<Parameter Name="rowLimit">
<DefaultValue>9999</DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces="True">*</ElementPath>
</Query>
By using this query, I am getting a dataset which includes all the columns of sharepoint list. Among these columns, I wanted to display only 2 columns (i.e Region and Sales type) using chart. I have created a Region parameter but when I click preview, the drop down box is giving me all the repeatative values of region like RG1,RG1,RG1,RG2,RG2,RG2,RG2,RG3.......... I wanted to display only distinct values of Region parameter so that whenever end user select region from the parameter drop down, it will display the respective value of Sales type column.
Also when I select only RG1 parameter, it is giving me a chart including the sales type of all the Regions. (it should display me only the sales type of RG1) How can I link these 2 columns so that they will display the values respectively.
I would really appreciate if anyone can help me out with this.
Thanks,
Sam.Hi Sam,
By code, the CAML language doesn’t have any reserved word (or tag) to set this particular filter to remove duplicate results.
In this case, we could use the custom code to get distinct records.
Here are the detailed steps:
1. Create a hidden parameter that gets all the records in one field.
Note: Please create another dataset that is same of the main dataset. This dataset is used for the parameter.
2. Create a function that used to remove the duplicate records.
Here is the code:
Public Shared Function RemoveDups(ByVal items As String) As String
Dim noDups As New System.Collections.ArrayList()
Dim SpStr
SpStr = Split(items ,",")
For i As Integer=0 To Ubound(Spstr)
If Not noDups.Contains(SpStr(i).Trim()) Then
noDups.Add(SpStr(i).Trim())
End If
Next
Dim uniqueItems As String() = New String(noDups.Count-1){}
noDups.CopyTo(uniqueItems)
Return String.Join(",", uniqueItems)
End Function
3. Create another parameter that will be used for filtering the maindata.
Please set the available value to be =Split(Code.RemoveDups(JOIN(Parameters!ISSUE_STATUS_TEMP.Value, ",")), ",")
And the default value to be the value you what such as the first value:
=Split(Code.RemoveDups(JOIN(Parameters!ISSUE_STATUS_TEMP.Value, ",")), ",").(0)
4. Go to the main dataset. Open the property window of this dataset.
5. In the “Filters” tab, set the filter to be:
Expression: <The field to be filter>
Operator: =
Value: =Parameters!Region.Value
The parameter “Region” should be the parameter we created in the step3.
Now, we should get distinct values of SharePoint columns.
If there is anything unclear, please feel free to ask.
Thanks,
Jin
Jin Chen - MSFT -
Get distinct values from plsql array
Hi,
I have declared a variable as below in plsql proc.
type t_itemid is table of varchar2(10);
inserted set of items in to this using a program
now i want distinct values from that array how can i get it.I am using 9i so i cannot use set operator and more over my problem is that i am declaring the variable inside the plsql block . when i tried i am getting the below errors:
SQL> r
1 declare
2 type t_type is table of varchar2(10);
3 v_type t_type;
4 begin
5 v_type := t_type('toys','story','good','good','toys','story','dupe','dupe');
6 for i in (select column_value from table(v_type)) loop
7 dbms_output.put_line(i.column_value);
8 end loop;
9* end;
for i in (select column_value from table(v_type)) loop
ERROR at line 6:
ORA-06550: line 6, column 41:
PLS-00642: local collection types not allowed in SQL statements
ORA-06550: line 6, column 35:
PL/SQL: ORA-22905: cannot access rows from a non-nested table item
ORA-06550: line 6, column 10:
PL/SQL: SQL Statement ignored
ORA-06550: line 7, column 22:
PLS-00364: loop index variable 'I' use is invalid
ORA-06550: line 7, column 1:
PL/SQL: Statement ignored -
CE function to get distinct values from Column table
Hi All,
Could you please let me know the appropriate CE function to get the distinct values from column table.
IT_WORK = SELECT DISTINCT AUFNR FROM :IT_WO_DETAILS;
Thank you.Hi,
If you have 10g, you can use Model( with model performance is better than connect by )
Solution
========================================================================
WITH t AS
(SELECT '0989.726332, 1234.567432, 3453.736379, 3453.736379, 0989.726332, 3453.736379, 1234.567432, 1234.567432, 0989.726332'
txt
FROM DUAL)
SELECT DISTINCT TRIM(CHAINE)
FROM T
MODEL
RETURN UPDATED ROWS
DIMENSION BY (0 POSITION)
MEASURES (CAST( ' ' AS VARCHAR2(50)) AS CHAINE ,txt ,LENGTH(REGEXP_REPLACE(txt,'[^,]+',''))+1 NB_MOT)
RULES
(CHAINE[FOR POSITION FROM 1 TO NVL(NB_MOT[0],1) INCREMENT 1] =
CASE WHEN NB_MOT[0] IS NULL THEN TXT[0] ELSE REGEXP_SUBSTR(txt[0],'[^,]+',1,CV(POSITION)) END );
=========================================================================
Demo
=======================================================================
SQL> WITH t AS
2 (SELECT '0989.726332, 1234.567432, 3453.736379, 3453.736379, 0989.726332, 3453.736379, 123
4.567432, 1234.567432, 0989.726332'
3 txt
4 FROM DUAL)
5 SELECT DISTINCT TRIM(CHAINE)
6 FROM T
7 MODEL
8 RETURN UPDATED ROWS
9 DIMENSION BY (0 POSITION)
10 MEASURES (CAST( ' ' AS VARCHAR2(50)) AS CHAINE ,txt ,LENGTH(REGEXP_REPLACE(txt,'[^,]+',''))+1 NB_MOT)
11 RULES
12 (CHAINE[FOR POSITION FROM 1 TO NVL(NB_MOT[0],1) INCREMENT 1] =
13 CASE WHEN NB_MOT[0] IS NULL THEN TXT[0] ELSE REGEXP_SUBSTR(txt[0],'[^,]+',1,CV(POSITION)) END );
TRIM(CHAINE)
3453.736379
1234.567432
0989.726332
SQL>
========================================================================
Maybe you are looking for
-
Re: Native Language Support in Forte
[email protected] wrote: I've been posed a question in the abstract about Forte's native language support. Does Forte support any languages other than C/C++? And if so, what are the limitations or caveats? Native Language Support could also mean the NL
-
CNTRL D shortcut for inserting transition only works intermittently
I put a clip on the work timeline, cut it in places and position the ends of clips abutting, place the cursor between them and select one or both clips. Control D will work for about 3 events then it stops. Reseting shortcuts to factory does nothing.
-
Help! I have tried to use my elements 9 which was already installed on my macbook pro 10.5.8 and it has begun giving me error messages that state there are some missing components on the app and I should reinstall. I have reinstalled and am getting
-
Mapping 2 text files with conditions
Hi, I am just trying to get my head around what would be the best solution that could be implemented in ODI to the following task I have. I have 2 text files the first file is in the format of AccCode | ChildCodeStart | ChildCodeFinish B1000 1000 109
-
Hi ABAP gurus, I have a RFC function module. It brings back data in an internal table from remote system. Now the problem is the data from the remote ststem is very huge, something like 1,00,000 records. So it takes a lot of time and bandwidth. Som