Pivot in oracle 10g
Hi Master ,
Q1>
I have two column in a table on oracle 10g.
data like :
NAME DATE
a 10-JAN-13
a 11-JAN-13
a 12-JAN-13
I want the output like :
NAME DATE
a 10-JAN-13,11-JAN-13,12-JAN-13.
Q2>
How can i use pivot in oracle 10g.
plz. help.
Ekalabya wrote:
I want the output like :
NAME DATE
a 10-JAN-13,11-JAN-13,12-JAN-13.this looks like string concatenation: http://www.oracle-base.com/articles/misc/string-aggregation-techniques.php
Pivoting in10g: Pivot function in Oracle 10g???
Similar Messages
-
Requesting help with pivot in Oracle 10g
Hey all,
I have this table, let's call it table GRID that has the following columns:
OBJECT_KEY DATE_KEY SEGMENT_ID COLUMN_NAME COMMITTEDVIRTUALMEMORYSIZE_AVG
619 3371 1 M1100 593589862.4
619 3371 1 M1105 593611434.67
620 3371 1 M1100 592354508.8
620 3371 1 M1105 592376263.11
621 3371 1 M1100 731433369.6
621 3371 1 M1105 731455943.11What would it take to pivot the column names ('M1100', 'M1105') with the metric value volumn: 'COMMITTEDVIRTUALMEMORYSIZE_AVG' so much that this query would result in an output like this:
OBJECT_KEY DATE_KEY SEGMENT_ID M1100 M1105
619 3371 1 593589862.4 593611434.67
620 3371 1 592354508.8 592376263.11
621 3371 1 731433369.6 731455943.11Any help would be much appreciated!
Again, Oracle 10g, not 11g so I don't have the PIVOT function to work with.
Regards,
TimSHi,
Search for Pivot:, or see the example below, for how to do a basic pivot. (This was called "pivot" long before Oracle 11.)
The example below uses COUNT as the aggregate function; you'll probably wnat SUM instead.
If you don't know how many pivoted columns there will be (two, in the example you posted), or what their unique values are ('M1100' and 'M1105') ahead of time, then you will need dynamic SQL. As dynamic SQL goes, this is pretty easy; you can do it in either SQL*Plus or PL/SQL.
-- How to Pivot a Result Set (Display Rows as Columns)
-- For Oracle 10, and earlier
-- Actually, this works in any version of Oracle, but the
-- "SELECT ... PIVOT" feature introduced in Oracle 11
-- is better. (See Query 2, below.)
-- This example uses the scott.emp table.
-- Given a query that produces three rows for every department,
-- how can we show the same data in a query that has one row
-- per department, and three separate columns?
-- For example, the query below counts the number of employess
-- in each departent that have one of three given jobs:
PROMPT ========== 0. Simple COUNT ... GROUP BY ==========
SELECT deptno
, job
, COUNT (*) AS cnt
FROM scott.emp
WHERE job IN ('ANALYST', 'CLERK', 'MANAGER')
GROUP BY deptno
, job;
Output:
DEPTNO JOB CNT
20 CLERK 2
20 MANAGER 1
30 CLERK 1
30 MANAGER 1
10 CLERK 1
10 MANAGER 1
20 ANALYST 2
PROMPT ========== 1. Pivot ==========
SELECT deptno
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst_cnt
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk_cnt
, COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS manager_cnt
FROM scott.emp
WHERE job IN ('ANALYST', 'CLERK', 'MANAGER')
GROUP BY deptno;
-- Output:
DEPTNO ANALYST_CNT CLERK_CNT MANAGER_CNT
30 0 1 1
20 2 2 1
10 0 1 1
-- Explanation
(1) Decide what you want the output to look like.
(E.g. "I want a row for each department,
and columns for deptno, analyst_cnt, clerk_cnt and manager_cnt)
(2) Get a result set where every row identifies which row
and which column of the output will be affected.
In the example above, deptno identifies the row, and
job identifies the column.
Both deptno and job happened to be in the original table.
That is not always the case; sometimes you have to
compute new columns based on the original data.
(3) Use aggregate functions and CASE (or DECODE) to produce
the pivoted columns.
The CASE statement will pick
only the rows of raw data that belong in the column.
If each cell in the output corresponds to (at most)
one row of input, then you can use MIN or MAX as the
aggregate function.
If many rows of input can be reflected in a single cell
of output, then use SUM, COUNT, AVG, STRAGG, or some other
aggregate function.
GROUP BY the column that identifies rows.
PROMPT ========== 2. Oracle 11 PIVOT ==========
WITH e AS
( -- Begin sub-query e to SELECT columns for PIVOT
SELECT deptno
, job
FROM scott.emp
) -- End sub-query e to SELECT columns for PIVOT
SELECT *
FROM e
PIVOT ( COUNT (*)
FOR job IN ( 'ANALYST' AS analyst
, 'CLERK' AS clerk
, 'MANAGER' AS manager
NOTES ON ORACLE 11 PIVOT:
(1) You must use a sub-query to select the raw columns.
An in-line view (not shown) is an example of a sub-query.
(2) GROUP BY is implied for all columns not in the PIVOT clause.
(3) Column aliases are optional.
If "AS analyst" is omitted above, the column will be called 'ANALYST' (single-quotes included).
{code} -
Pivot function in Oracle 10g???
Hello everybody,
at the beginning of the week I had a simple problem (I thought that...), but now after trying and trying, I can't find a solution for it. First of all I'm working on Oracle 10g with the version 10.2.0.4.0. I can't change the version, it's standard in the whole company...
At the beginning I have a table like the following one, but please note, that the compartment, the type and the amount are flexible and can change at any time:
comp type amount
a1 6280 10
a2 6280 20
a2 4810 15
a2 1147 12
a3 6280 33
Now I want the table to look like this:
a1 a2 a3
1147 0 12 0
4810 0 15 0
6280 10 20 33
A simple question in Excel for example, I just use the pivot function and have it fixed within 10seconds. But how can I do sth. like this in Oracle with simple SQL? Or it can be PL/SQL too, cause I will use this in an APEX application.
Can you please give me a hint or a solution? But as stated before a1, a2, a3 are just examples it is possible that tomorrow a4, a5 and so on are coming. If it is necessary I can also create additional tables and views of course!
Thanks for your help!
Regards
hogeHi Hoge!
Here is your solution:
SELECT TYPE,
sum(a1) AS a1,
sum(a2) AS a2,
sum(a3) AS a3
FROM (SELECT TYPE,
decode(comp, 'a1', amount, 0) AS a1,
decode(comp, 'a2', amount, 0) AS a2,
decode(comp, 'a3', amount, 0) AS a3
FROM test)
GROUP BY TYPE
ORDER BY TYPE; And here is my test case setup:
CREATE TABLE test
(comp VARCHAR2(255),
TYPE NUMBER,
amount NUMBER);
INSERT INTO test(comp, TYPE, amount) VALUES('a1', 6280, 10);
INSERT INTO test(comp, TYPE, amount) VALUES('a2', 6280, 20);
INSERT INTO test(comp, TYPE, amount) VALUES('a2', 4810, 15);
INSERT INTO test(comp, TYPE, amount) VALUES('a2', 1147, 12);
INSERT INTO test(comp, TYPE, amount) VALUES('a3', 6280, 33);
commit;Best regards,
Matt -
APEX 3.2 -ORACLE 10G - PIVOT QUERY
Hello, i searched around the forum and i cound't find an answer to this specific matter, although i saw some replies that were close...
i need to creat a form based on a pivot query. but oracle 10g doesn't support that feature so i hope someone can help me.
my problem is that the number of columns will be variable. here's an example:
ORIGINAL TABLE
NAME KMS VEHICLE
Joe 100 AUDI
Tom 300 VW
Mark 150 FORD
Ann 250 FORD
Joe 200 VW
Tom 123 AUDI
Mark 345 AUDI
Ann 45 VW
Joe 6 FORD
Tom 67 FORD
Mark 46 VW
Ann 99 AUDI
DESIRED RESULT
Joe Tom Mark Ann Vehicle
100 123 345 99 AUDI
6 67 150 250 FORD
200 300 46 45 VW
the new columns will be the values in the old NAME column. BUT these values are variable. today its joe,tom,mark and ann tomorrow it could be silvia, tony,richard,harry , william and jane. this means the usuall replies i saw, using MAX and DECODE will not apply because i never know what values or how many values are in this column. with pivot i can get this done.... how can i do this in oracle 10g? is there a way to creat a ser function Pivot somehow? ideas?
thanks!
Mark Pereira
Edited by: 899716 on Jul 18, 2012 12:02 PMThis is the Oracle Forms forum. Post your question in the SQL forum.
Tip: check the latest Oracle Magazine (July/August 2012). There is an article by Tom Kyte about the same question.
http://www.oracle.com/technetwork/oramag/magazine/home/index.html -
Hi,
I want to create a view. Sales amounts, countries and products will be showed in this view.
Report result will be like below:
Products
Countries Sales_Amount
TV Ipad Iphone Netbook Notebook EbookReader
England 1000 1200 1400 3000 5000 200
Germany 800 1000 1300 2800 6000 400
France 1100 1100 1500 2400 3000 500
Number of products are not limited. New prodcuts can be added by the time.
Customer is using Oracle 10g. So I can not use pivot function which cames with Oracle 11g.
If the number of products is limited, I can write sql by decode operators.
But I can not find how to implement pivot function in Oracle 10g with unlimited column values.
Do you have any comment?
Thanks,RegardsFrom the SQL and PL/SQL FAQ:
"This is not easily possible as the number of columns returned by an SQL must be known before any data is fetched, it would have to be done dynamically.
See these threads:
Franks pivoting, static and dynamic
Dynamic Columns Pipelined"
SQL and PL/SQL FAQ -
Pivot and Unpivot in Oracle 10g
Hi,
This is my table structure
CREATE TABLE TESTTABLE
REVENUE1 NUMBER,
REVENUE2 NUMBER,
REVENUE3 NUMBER,
YEAR DATE
insert into testtable(revenue1, revenue2, revenue3, year) values(100,200,300,'1-Jan-2009') ;
insert into testtable(revenue1, revenue2, revenue3, year) values(250,350,450,'1-Jan-2010') ;
insert into testtable(revenue1, revenue2, revenue3, year) values(300,400,500,'1-Jan-2011') ;
The resultant should be on oracle 10g.
The result should be like
1-Jan-2009 1-Jan-2010 1-Jan-2011
Revenue1 100 250 300
Revenue2 200 350 400
Revenue3 300 450 500
Thanks in advanceHi,
Naveen wrote:
...Thanks for the reply but this will not make the year as the column header it will be shown as a row in the result set.That's exactly what I thought you wanted, based on your first message:
Naveen wrote:
The result should be like
1-Jan-2009 1-Jan-2010 1-Jan-2011
Revenue1 100 250 300
Revenue2 200 350 400
Revenue3 300 450 500It would have been clearer if you had said: "The result set should be like these 3 rows:
{code}
Label 1-Jan-2009 1-Jan-2010 1-Jan-2011
Revenue1 100 250 300
Revenue2 200 350 400
Revenue3 300 450 500
{code}
When posting formatted text (such as results) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
Column names are hard-coded into the query. To get variable data, such as '1-Jan-2009' as a column header, you must use dynamic SQL. This is probably best done in your front-end. SQL*Plus, for example, has substitution variables, that you can define with data from your table at run-time using the COLUMN ... NEW_VALUE command. (SQL*Plus also has a COLUMN ... HEADING command that can do what you want, , but it doesn't simplify this particular problem.)
What front-end tool are you using? Can you use SQL*Plus? -
Hello there,
May I know the ways to realise PIVOT in oracle.
I mean to say
Input
stud mark1 mark2 mark3
x 100 200 300
output
stud mark
x 100
x 200
x 300
ThanksOn a more constructive note you can also use the nested table unnesting feature here to do a pivot.
I find it rather neater than UNION ALL but you may want to check that it is equally performant.
Connected to:
Oracle Database 10g Release 10.2.0.2.0 - Production
SQL> CREATE TABLE table_name (
2 stud VARCHAR2 (1),
3 mark1 NUMBER,
4 mark2 NUMBER,
5 mark3 NUMBER);
Table created.
SQL> INSERT INTO table_name VALUES ('x', 100, 200, 300);
1 row created.
SQL> CREATE TYPE number_table AS TABLE OF NUMBER;
2 /
Type created.
SQL> SELECT stud, column_value mark_n
2 FROM table_name, TABLE (number_table (mark1, mark2, mark3));
S MARK_N
x 100
x 200
x 300
SQL> CREATE TYPE ot_number AS OBJECT (
2 name VARCHAR2 (30),
3 value NUMBER);
4 /
Type created.
SQL> CREATE TYPE ntt_number AS TABLE OF ot_number;
2 /
Type created.
SQL> SELECT stud, name, value
2 FROM table_name, TABLE (
3 ntt_number (
4 ot_number ('mark1', mark1),
5 ot_number ('mark2', mark2),
6 ot_number ('mark3', mark3)));
S NAME VALUE
x mark1 100
x mark2 200
x mark3 300
SQL> -
Dynamic rows to columns oracle 10g
Hi,
I'm using oracle 10g. I have a requiriement where I need to show rows to columns. I have read through many posts but I couldn't find what I wanted to solve. Lots of them are using decode, since they know the values in one column.
My table has name, value and date. I need to get values for each name at certain date (each distinct date needs to become column). I don't know the name beforehand.
Name, Value, Date
T1 100 06-27-2011 09:00:00
T2 100 06-27-2011 09:00:00
T1 200 06-27-2011 09:15:00
T2 150 06-27-2011 09:15:00
I would also need to use a date range. Someone can request date between 09:00:00 and 09:05:00 or 09:00:00 and 09:30:00 etc.
I need to print
Name, 06-27-2011 09:00:00, 06-27-2011 09:15:00
T1 100 200
T2 100 150
Appreciate any advice on this.
Edited by: user8801143 on 28-Jun-2011 08:23With 10g
see http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:766825833740#2989343200346664698
search for post on February 11, 2011 and reply on February 14, 2011
with 11g see the pivot clause -
Error while installing Oracle 10g on Fedora Core 1
Error while installing Oracle 10g on Fedora Core 1. After 40% of the Installation is thru, the progress bar is showing 40%, it gives error "Not connected to Oracle" and the installation has to be terminated.
We have tried by using the on-line procedure and changing the required script to make believe it as said.Are you createing DB also???
-
Error while sending a mail using UTP_MAIL package in Oracle 10g
Hi,
We are using UTP_MAIL package to send a mail from Oracle 10g.We have follwed the following steps ...
SQL> connect sys/password as sysdba
Connected.
SQL> @$ORACLE_HOME/rdbms/admin/utlmail.sql
Package created.
Synonym created.
SQL> @$ORACLE_HOME /rdbms/admin/prvtmail.plb
Package body created.
SQL > alter system set smtp_out_server = '<mail_server_ip:25>' scope =spfile;
System altered..
Now we try the code
begin
utl_mail.send(
sender => 'sender's mail',
recipients => 'receiver mail',
CC => 'optional',
subject => 'Testing utl_mail',
message => 'Test Mail'
end;
But we get the following error...
ERROR at line 1:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 21
ORA-06512: at "SYS.UTL_SMTP", line 97
ORA-06512: at "SYS.UTL_SMTP", line 139
ORA-06512: at "SYS.UTL_MAIL", line 405
ORA-06512: at "SYS.UTL_MAIL", line 594
ORA-06512: at line 2
We also tried connecting to the mail server through telnet .But it is not getting connected..
Please help us to solve the issue.From your own posting you may have the clue, if you try to access your mail server through telnet and it is not successful, it means the service is down or there are networking issues.
On pre 10gR2 versions there was a bug 4083461.8. It could affect you if you are on 10gR1
"Bug 4083461 - UTL_SMTP.OPEN_CONNECTION in shared server fails with ORA-29278 Doc ID: Note:4083461.8"
This was fixed on 10gR2 base and on 9.2.0.8.0
~ Madrid -
FRM-41211 Integration Error SSL - OracleAS 10g
Hi.
I have error Frm-41211 Integration Error SSL Failure Running Another Product error while calling a report from web form in oracleAS 10g.
I have problem with RUN_REPORT_OBJECT in web forms.
I have error: FRM-41211 SSL integration error .....
OracleAS server began on Windoes XP SP2.
Do you help me ?Hi,
I remember having seen this issue in teh apst. My best recommendation is to work with customer support (metalink.oracle.com)
Frank -
Stopping the Enterprise Manager Console (Oracle 10g on SuSE 9.1)
I'm trying to stop the Enterprise Manager Console by issuing the command:
${ORACLE_HOME}/bin/emctl stop dbconsole
Unfortunately, the command fails to stop the EM Console. Here's the output I get:
TZ set to US/Pacific
Oracle Enterprise Manager 10g Database Control Release 10.1.0.2.0
Copyright (c) 1996, 2004 Oracle Corporation. All rights reserved.
http://<hostname>:5505/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
--- Failed to shutdown DBConsole Gracefully ---
failed.
The only way I can stop the EM Console (and related services--i.e., emagent) is to kill its process.
Everything (Listener, DB Instance, EM Console) starts fine. I can stop the Listener and DB Instance without any problems. It's just the EM Console shutdown that doesn't happen cleanly.
Has anyone else encountered the same condition? If so, what was the solution?
Here's my operating environment:
SuSE 9.1 (Kernel 2.6.5-7.108-default)
Oracle 10g
Thanks in advance for any help/insight.Has anyone else encountered the same condition? If so, what was the solution?Yes. Shutdown/reboot of the system made the error go away.
Sorry, no better clues,
Toni -
Migration from Oracle 9i 32 bit to Oracle 10G 64 bit on Windows 2003 Server
I am working on migrating Oracle 9i 32 bit to Oracle 10G 64 bit on Windows 2003 from Old server to new server. We have db around 500 GB and 3 schemas. I installed Oracle 10G on new server, created tablespaces, schema's blah blah and now doing export and import at schema level from old server to new server.
Import is taking more than 4 to 5 hours on new server. My manager is saying, window time is bit longer and he wants me to try possiblities to make this process faster. Can some one help me on this, to use the best possible method to complete this process faster?
Will below step work, if I try?
If I install, oracle 9i and 10g both on new server in different home directories and take the hot backup from old machine and restore on new machine in 9i home directory and use the upgrade configuration assistant from 10g and do the upgrade? Pls advice.
Thanks in advance,
Hari babu
Edited by: user6367891 on Mar 2, 2010 5:28 AMIt looks good.
I have one question in below steps:
To migrate an Oracle9i or older database to an Oracle Database 10g Release 1 (10.1) database for 64-bit Windows:
1 Perform steps 1 - 11 in "Migrating an Oracle Database 10g Release 1 (10.1) Database".
2 Shut down the database on the 64-bit computer:
SQL> SHUTDOWN IMMEDIATE;
3 Start the database migration:
SQL> STARTUP MIGRATE;
4 Migrate the database as described in Chapter 3, "Upgrading a Database to the New Oracle Database 10g Release" in Oracle Database Upgrade Guide.
In step 4, it says, migrate database as described in chapter 3. In chapter 3, it says, to do the upgrade the process using dbca or manually. Pls confirm whether do the upgrade process after issuing startup migrate or not.
Thanks in advance. -
Oracle 10G New Feature........Part 1
Dear all,
from last couple of days i was very busy with my oracle 10g box,so i think this is right time to
share some intresting feature on 10g and some internal stuff with all of you.
Have a look :-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oracle 10g Memory and Storage Feature.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.Automatic Memory Management.
2.Online Segment Shrink
3.Redolog Advisor, checkpointing
4.Multiple Temporary tablespace.
5.Automatic Workload Repository
6.Active Session History
7.Misc
a)Rename Tablespace
b)Bigfile tablespace
c)flushing buffer cache
8.ORACLE INTERNAL
a)undocumented parameter (_log_blocks_during_backup)
b)X$ view (x$messages view)
c)Internal Structure of Controlfile
1.Automatic memory management
================================
This feature reduce the overhead of oracle DBA.previously mostly time we need to set diff oracle SGA parameter for
better performance with the help of own experience,advice views and by monitoring the behaviour
of oracle database.
this was just time consuming activity.........
Now this feature makes easy life for oracle DBA.
Just set SGA_TARGET parameter and it automatically allocate memory to different SGA parameter.
it focus on DB_CACHE_SIZE
SHARED_POOL_SIZE
LARGE_POOL
JAVA_POOL
and automatically set it as
__db_cache_size
__shared_pool_size
__large_pool_size
__java_pool_size
check it in alert_log
MMAN(memory manager) process is new in 10g and this is responsible for sga tuning task.
it automatically increase and decrease the SGA parameters value as per the requirement.
Benefit:- Maximum utlization of available SGA memory.
2.Online Segment Shrink.
==========================
hmmmmm again a new feature by oracle to reduce the downtime.Now oracle mainly focus on availablity
thats why its always try to reduce the downtime by intrducing new feature.
in previous version ,reducing High water mark of table was possible by
Exp/imp
or
alter table move....cmd. but on these method tables was not available for normal use for long hrs if it has more data.
but in 10g with just few command we can reduce the HWmark of table.
this feature is available for ASSM tablespaces.
1.alter table emp enable row movement.
2.alter table emp shrink space.
the second cmd have two phases
first phase is to compact the segment and in this phase DML operations are allowed.
second phase(shrink phase)oracle shrink the HWM of table, DML operation will be blocked at that time for short duration.
So if want to shrink the HWM of table then we should use it with two diff command
first compact the segment and then shrink it on non-peak hrs.
alter table emp shrink space compact. (This cmd doesn't block the DML operation.)
and alter table emp shrink space. (This cmd should be on non-peak hrs.)
Benefit:- better full table scan.
3.Redolog Advisor and checkpointing
================================================================
now oracle will suggest the size of redo log file by V$INSTANCE_RECOVERY
SELECT OPTIMAL_LOGFILE_SIZE
FROM V$INSTANCE_RECOVERY
this value is influence with the value of FAST_START_MTTR_TARGET .
Checkpointing
Automatic checkpointing will be enable after setting FAST_START_MTTR_TARGET to non-zero value.
4.Multiple Temporary tablespace.
==================================
Now we can manage multiple temp tablespace under one group.
we can create a tablespace group implicitly when we include the TABLESPACE GROUP clause in the CREATE TEMPORARY TABLESPACE or ALTER TABLESPACE statement and the specified tablespace group does not currently exist.
For example, if group1 is not exists,then the following statements create this groups with new tablespace
CREATE TEMPORARY TABLESPACE temp1 TEMPFILE '/u02/oracle/data/temp01.dbf'
SIZE 50M
TABLESPACE GROUP group1;
--Add Existing temp tablespace into group by
alter tablespace temp2 tablespace group group1.
--we can also assign the temp tablespace group on database level as default temp tablespace.
ALTER DATABASE <db name> DEFAULT TEMPORARY TABLESPACE group1;
benefit:- Better I/O
One sql can use more then one temp tablespace
5.AWR(Automatic Workload Repository):-
================================== AWR is built in Repository and Central point of Oracle 10g.Oracle self managing activities
is fully dependent on AWR.by default after 1 hr, oracle capure all database uses information and store in AWR with the help of
MMON process.we called it Memory monitor process.and all these information are kept upto 7 days(default) and after that it automatically purge.
we can generate a AWR report by
SQL> @?/rdbms/admin/awrrpt
Just like statspack report but its a advance and diff version of statspack,it provide more information of Database as well as OS.
it show report in Html and Text format.
we can also take manually snapshot for AWR by
BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
END;
**The STATISTICS_LEVEL initialization parameter must be set to the TYPICAL or ALL to enable the Automatic Workload Repository.
[oracle@RMSORA1 oracle]$ sqlplus / as sysdba
SQL*Plus: Release 10.1.0.2.0 - Production on Fri Mar 17 10:37:22 2006
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
SQL> @?/rdbms/admin/awrrpt
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
4174002554 RMSORA 1 rmsora
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: text
Type Specified: text
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
* 4174002554 1 RMSORA rmsora RMSORA1
Using 4174002554 for database Id
Using 1 for instance number
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed. Pressing <return> without
specifying a number lists all completed snapshots.
Listing the last 3 days of Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
rmsora RMSORA 16186 16 Mar 2006 17:33 1
16187 16 Mar 2006 18:00 1
16206 17 Mar 2006 03:30 1
16207 17 Mar 2006 04:00 1
16208 17 Mar 2006 04:30 1
16209 17 Mar 2006 05:00 1
16210 17 Mar 2006 05:31 1
16211 17 Mar 2006 06:00 1
16212 17 Mar 2006 06:30 1
16213 17 Mar 2006 07:00 1
16214 17 Mar 2006 07:30 1
16215 17 Mar 2006 08:01 1
16216 17 Mar 2006 08:30 1
16217 17 Mar 2006 09:00 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 16216
Begin Snapshot Id specified: 16216
Enter value for end_snap: 16217
End Snapshot Id specified: 16217
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_16216_16217.txt. To use this name,
press <return> to continue, otherwise enter an alternative.
Benefit:- Now DBA have more free time to play games.....................:-)
Advance version of statspack
more DB and OS information with self managing capabilty
New Automatic alert and database advisor with the help of AWR.
6.Active Session History:-
==========================
V$active_session_history is view that contain the recent session history.
the memory for ASH is comes from SGA and it can't more then 5% of Shared pool.
So we can get latest and active session report from v$active_session_history view and also get histortical data of
of session from DBA_HIST_ACTIVE_SESS_HISTORY.
v$active_session_history include some imp column like:-
~SQL identifier of SQL statement
~Object number, file number, and block number
~Wait event identifier and parameters
~Session identifier and session serial number
~Module and action name
~Client identifier of the session
7.Misc:-
========
Rename Tablespace:-
=================
in 10g,we can even rename a tablespace by
alter tablespace <tb_name> rename to <tb_name_new>;
This command will update the controlfile,data dictionary and datafile header,but dbf filename will be same.
**we can't rename system and sysaux tablespace.
Bigfile tablespace:-
====================
Bigfile tablespace contain only one datafile.
A bigfile tablespace with 8K blocks can contain a 32 terabyte datafile.
Bigfile tablespaces are supported only for locally managed tablespaces with automatic segment-space management.
we can take the advantage of bigfile tablespace when we are using ASM or other logical volume with RAID.
without ASM or RAID ,it gives poor response.
syntax:-
CREATE BIGFILE TABLESPACE bigtbs
Flushing Buffer Cache:-
======================
This option is same as flushing the shared pool,but only available with 10g.
but i don't know, whats the use of this command in prod database......
anyway we can check and try it on test server for tuning n testing some query etc....
SQL> alter system flush buffer_cache;
System altered.
++++++++++++++++++
8.Oracle Internal
++++++++++++++++++
Here is some stuff that is not related with 10g but have some intresting things.
a)undocumented parameter "_log_blocks_during_backup"
++++++++++++++++++++++++
as we know that oracle has generate more redo logs during hotbackup mode because
oracle has to maintain the a complete copy of block into redolog due to split block.
we can also change this behaviour by setting this parameter to False.
If Oracle block size equals the operating system block size.thus reducing the amount of redo generated
during a hot backup.
WITHOUT ORACLE SUPPORT DON'T SET IT ON PROD DATABASE.THIS DOCUMENT IS JUST FOR INFORMATIONAL PURPOSE.
b)some X$ views (X$messages)
++++++++++++++++
if you are intresting in oracle internal architecture then x$ view is right place for getting some intresting things.
X$messages :-it show all the actions that a background process do.
select * from x$messages;
like:-
lock memory at startup MMAN
Memory Management MMAN
Handle sga_target resize MMAN
Reset advisory pool when advisory turned ON MMAN
Complete deferred initialization of components MMAN
lock memory timeout action MMAN
tune undo retention MMNL
MMNL Periodic MQL Selector MMNL
ASH Sampler (KEWA) MMNL
MMON SWRF Raw Metrics Capture MMNL
reload failed KSPD callbacks MMON
SGA memory tuning MMON
background recovery area alert action MMON
Flashback Marker MMON
tablespace alert monitor MMON
Open/close flashback thread RVWR
RVWR IO's RVWR
kfcl instance recovery SMON
c)Internal Structure of Controlfile
++++++++++++++++++++++++++++++++++++
The contents of the current controlfile can be dumped in text form.
Dump Level Dump Contains
1 only the file header
2 just the file header, the database info record, and checkpoint progress records
3 all record types, but just the earliest and latest records for circular reuse record types
4 as above, but includes the 4 most recent records for circular reuse record types
5+ as above, but the number of circular reuse records included doubles with each level
the session must be connected AS SYSDBA
alter session set events 'immediate trace name controlf level 5';
This dump show lots of intresting information.
it also show rman recordes if we used this controlfile in rman backup.
Thanks
Kuljeet Pal SinghYou can find each doc in html and pdf format on the Documentation Library<br>
You can too download all the documentation in html format to have all on your own computer here (445.8MB)<br>
<br>
Nicolas. -
Oracle 10g - Defining the column name in Non English
Hi Experts,
I have an exisitng application which is developed on Windows using ASP Technology and uses Oracle 10g 10.1.0.2.0.
The application is supported with an instance of Data Base within which multiple tablespaces are created for different clients. The application is developed in such a way that some of the tables arecreated dynamically and the columns are named using the data entered through the UI.
This application needs to be globalized now. The problem is, the column name entered through the UI can be in any language based on the client's settings and those values in turn will be used for naming the columns in the tables.
1) Can I have the column names to be named using non english characters in Oracle 10g DB? If so,
1.1) what should I do to configure the exisiting Oracle instance to support it?
1.2) To what level is that configuration possible, is it per DB instance level (or) can it be done at Tablespace level. I would like to configure each tablespace to host tables with columns defined with different languages, say for example, tablespace 1 will have tables with Japaenese column names and tablespace 2 will have tables with German column names?
2) What should I do to make my entire DB to support unicode data i.e., to accept any language strings. Currently all strings are declared as VarChar2, should I change all VarChar2 to NVarChar2 (or) is there a way to retain the VarChar2 as is and make some database wide setting?
Please note that I do not have an option of retaining the column in English as per the Business Requirement.
Envionment:
OS - Windows 2003 32 bit
Oracle 10g 10.1.0.2.0
UI forms in ASP
TIA,
Prem1. Yes, you can.
SQL> create table ÜÝÞ( ßàá number(10));
Table created.
SQL> insert into ÜÝÞ values (10);
1 row created.1.1 and 1.2 and 2. You can choose UTF as your default character set. It allows the user of non-English characters in VARCHAR columns in your whole database. It is not per tablespace.
SQL> create table ÜÝÞ( ßàá varchar2(100));
Table created.
SQL> insert into ÜÝÞ values ('âãäçìé');
1 row created.
Maybe you are looking for
-
External Hardrive - from PC to Mac
I recently got a Macbook and when I plugged in my external hard drive (used originally on my Toshiba) I am able to see all my files however when I wanted to transfer photo to the hard drive I am not able to. No pop-up messages just the circle with li
-
Group Currency - adding with local 2nd currency
Dear All, If I can select 30 as Group Currency system automatically picks as "EUR" as a Group Company is Europe. The first Local Currency is INR. I want to bring the USD as the 2nd local currency. USD added the Country Code settings in IN and
-
Mail.app will not reopen after closing app
I am using a MacBook Pro with OS X 10.5.8 and Mail.app 3.6 (936). I have all current updates installed. My problem is that I will be using mail.app (configured as an IMAP account) all day and close the application without any issues, but if I reopen
-
H.264 transcoding broken in 10.5.2?
I'm working on an iDVD7 project containing five movie clips, with menus (using a 6.0 theme). My video clips are all edited and exported from iMovie 7.1.1, using Quicktime export to h.264 encoded .mov files. My last work copy burn on 10.5.1 was made a
-
Error converting image get error msg when trying to display thumbnail
Hi there Me again I am having some problems displaying thumbnails I keep getting the error Error converting image (create thumbnail). The "...........public_html/productimages/thumbnails/" folder has no write permissions. So I go to my host and chang