RMAN reporting using SQL*PLUS
I am trying to create a report that will take some of the rman schema views/tables and put it in a specified format for a report. I need to get the database name, start day and time, end day and time, how long the backup took in seonds, the backup status and the number of bytes of the backup. I also need it to span 2 days, i.e 6pm yeterday to 8am today. So far here is what I have:
select a.name,
to_char(MIN(b.start_time), 'MM-DD-YYYY') as "Start_Day",
to_char(MIN(b.start_time), 'HH24:MI:SS') as "Start_Time",
to_char(MAX(b.completion_time), 'MM-DD-YYYY HH24:MI:SS') as "End Day",
SUM(b.elapsed_seconds) as "Seconds",
b.status
from rman.rc_database a, rman.rc_backup_set b
WHERE a.DB_KEY = B.DB_KEY
AND a.DBID = B.DB_ID
AND trunc(b.Start_time) = trunc(sysdate)
GROUP BY a.name, b.status
order by 2,3,1
It only works for the current day and I can't seem to find the byte size for the backup piece. Any suggestions on how this should work I would relly appreciate it.
This is not a right forum to post your problem. This is SQL PL/SQL forum.
Please post it in Database General Forum.
Regards.
Satyaki De.
Similar Messages
-
Hwo to create a matrix report in sql Plus
i want to create matrix report in SQL plus for emp table. how is it possible
requirement is as following
Deptno -- Clerk -- Salesman--Manager
10----------2500---3500--------4500
20----------2400---3400--------4400
30----------1400---4400--------5400Hi,
Do a search on this site on
-'pivot'
and/or:
-'stragg'
and/or:
-'columns to rows'
to get many example that will give you ideas.
Also you forgot to mention this:
What's the value of the job titles?
Sum of salary of....?
edit
Using my data:
MHO%xe> select deptno, job, sal from emp order by deptno
2 /
DEPTNO JOB SAL
10 MANAGER 2450
10 PRESIDENT 5000
10 CLERK 1300
20 ANALYST 3000
20 CLERK 800
20 CLERK 1100
20 ANALYST 3000
20 MANAGER 2975
30 MANAGER 2850
30 SALESMAN 1600
30 CLERK 950
30 SALESMAN 1250
30 SALESMAN 1500
30 SALESMAN 1250
14 rijen zijn geselecteerd.I would get:
MHO%xe> select deptno
2 , sum(decode(job,'CLERK',sal,0)) CLERK
3 , sum(decode(job,'SALESMAN',sal,0)) SALESMAN
4 , sum(decode(job,'MANAGER',sal,0)) MANAGER
5 from emp
6 group by deptno
7 order by deptno
8 /
DEPTNO CLERK SALESMAN MANAGER
10 1300 0 2450
20 1900 0 2975
30 950 5600 2850Edited by: hoek on Oct 17, 2009 3:19 PM -
SAP Crystal Report using SQL Server Authentication and Windows Authenticati
I'm a SAP Crystal Report, version for Visual Studio 2010 Beginner
my ingredients are
1.windows 7 ultimate service pack1
2.sql server 2008 standard edition
3.visual studio 2010 pro
4.SAP Crystal Report, version for visual studio.net
I was created a report named customersByCity.rpt using OLE DB (ADO) -> Microsoft OLE DB Provider for SQL Server -> I'm supply Server, User ID, Password and Database. I assume me using SQL Server Authentication for my report
Then, my ASP.NET files as following
//ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="viewCustomersByCity.aspx.cs" Inherits="viewCustomersByCity" %>
<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div><asp:Label ID="lblMsg" runat="server" BackColor="Yellow" ForeColor="Black"></asp:Label>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true"></CR:CrystalReportViewer>
</div>
</form>
</body>
</html>
//code-behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
public partial class viewCustomersByCity : System.Web.UI.Page
private const string PARAMETER_FIELD_NAME = "city";
private ReportDocument customersByCityReport;
private void ConfigureCrystalReports()
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = @"WKM1925-PCWKM1925";
connectionInfo.DatabaseName = "Northwind";
connectionInfo.UserID = "sa";
connectionInfo.Password = "sysadmin25";
SetDBLogonForReport(connectionInfo);
private void SetDBLogonForReport(ConnectionInfo connectionInfo)
TableLogOnInfos tableLogOnInfos = CrystalReportViewer1.LogOnInfo;
foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
tableLogOnInfo.ConnectionInfo = connectionInfo;
private void SetCurrentValuesForParameterField(ReportDocument reportDocument, ArrayList arrayList)
ParameterValues currentParameterValues = new ParameterValues();
foreach (object submittedValue in arrayList)
ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
parameterDiscreteValue.Value = submittedValue.ToString();
currentParameterValues.Add(parameterDiscreteValue);
ParameterFieldDefinitions parameterFieldDefinitions = reportDocument.DataDefinition.ParameterFields;
ParameterFieldDefinition parameterFieldDefinition = parameterFieldDefinitions[PARAMETER_FIELD_NAME];
parameterFieldDefinition.ApplyCurrentValues(currentParameterValues);
protected void Page_Load(object sender, EventArgs e)
customersByCityReport = new ReportDocument();
string reportPath = Server.MapPath("customersByCity.rpt");
customersByCityReport.Load(reportPath);
ConfigureCrystalReports();
ArrayList arrayList = new ArrayList();
arrayList.Add("paris");
arrayList.Add("Madrid");
arrayList.Add("Marseille");
arrayList.Add("Buenos Aires");
arrayList.Add("Sao Paulo");
ParameterFields parameterFields = CrystalReportViewer1.ParameterFieldInfo;
SetCurrentValuesForParameterField(customersByCityReport, arrayList);
CrystalReportViewer1.ReportSource = customersByCityReport;
1st scenario
When in a runtime, it's keep appear a dialog box. This dialog box ask me to suppy Server, User ID, Password and Database. Once all information is supplied, my report display the data as expected
2nd scenario
I change my report using OLE DB (ADO) -> Microsoft OLE DB Provider for SQL Server -> checked on Integrated Security. I just choose Server, and Database. I assume me using Windows Authentication
When in a runtime, there's no dialog box as above. My report display the data as expected. really cool
Look's like, when report using SQL Server Authentication there's some problem. but, when report using Windows Authentication, it's fine.
I'm looking for comment. Please help meHello,
MS SQL Server 2008 requires you to install the MS Client Tools for 2008.
Once install then update all of your reports to use the SQL Native 10 as the OLE DB driver.
The try again, if it still fails search, lots of sample log on code in this forum.
Don -
Create statspack report using sql*developer
Hello,
While connecting with PERFSTAT user I can not create statspack report using SQL*Developer:
@?/rdbms/admin/awrrpt
Error starting at line 1 in command:
@?/rdbms/admin/awrrpt
Error report:
Unable to open file: "?/rdbms/admin/awrrpt.sql"
Actually, my problem or question is that how can PERFSTAT user can generate statspack reports from a Client side. What is the other way a non-dba can see the snapshots histroy and generate report (by using perfstat user ) while joing tables or using views?
Thanks a lot.
Best RegardsHi,
for awr reports @?/rdbms/admin/awrrpt (you need EE+Diagnostic Pack) there is a solution.
Grant execute dbms_workload_repository to <user>;
Grant select_catalog_role to <user>;
get all SNAP_IDs
SELECT TO_CHAR(s.startup_time,'YYYY.MM.DD HH24:MI:SS') INSTART_FMT,
di.instance_name INST_NAME,
di.db_name DB_NAME,
s.snap_id SNAP_ID,
TO_CHAR(s.end_interval_time,'YYYY.MM.DD HH24:MI:SS') SNAPDAT,
s.snap_level LVL
FROM dba_hist_snapshot s,
dba_hist_database_instance di
WHERE di.dbid = s.dbid
AND di.instance_number = s.instance_number
AND Di.Startup_Time = S.Startup_Time
ORDER BY snap_id desc;
Select * From Table(Sys.Dbms_Workload_Repository.Awr_Report_Html(DBID, 1, BEGIN_SNAP_ID, END_SNAP_ID));
For statspack i don't know a solutuion. I think the best idea is, create a job to make the statspack report on the server side and access it via external tables or mail them forward to you.
Best regards
Thomas -
Print a report from sql*plus.
Regards all
Let me know whether it is possible to print a hard report rom sql*plus and how.
waitingLet me know whether it is possible to print a hard report rom sql*plus Yes. SPOOL is a command to get SQL*Plus screen results to disk real-time.
and how.A "report" is such a generic term, that you will have to get started with at least some reading :)
http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/server.920/a90842/toc.htm
(search for: "How Can I Learn SQL*Plus")
You may also address specific questions about the SQL*Plus product (that are not really Database SQL and/or PL/SQL related) via the [Technologies>Tools>iSQL*Plus] forum rather than here.
waiting That's up to you! Dig in!
Michael O'Neill
Publisher of the PigiWiki
clever-idea.com -
Create database table using Forms Developer 6/6i without using SQL*Plus
hello there,
I need help in creating tables in Oracle using Forms Developer 6/6i without using SQL*Plus interface.
your help is appreciated
email: [email protected]please use Forms_ddl package to create a table dynamically
from the Developer6/6i.
you can check the success or failure by using the
form_success builtin.
if u want to avoid using the Forms_ddl package
use stored procedure or create a sql querry record group.
regards
sriram. -
Can v read a client text file using SQL*plus??
We have a requirement like this: We need to read a text file to find spelling mistakes. Problem is the file has to be always moved to the DB machine, which is a Linux box and then run a stored procedure which uses UTL_FILE. Now in order to show the spelling mistakes of the file the user will have to again copy the file with the spelling mistakses (output file) from Linux to Windows.
Is there a way to do it using SQL*Plus, where the text file is in the client machine???? Then users don't have to copy the file to and from the Linux box.SQL*Plus is a client software and whatever code you write using SQL*Plus, it ultimately run on the server. So the answers to your question is "no".
-
Cannot connect to database using SQL*Plus
Hi, I have Oracle 10g XE installed in my labtop and I cannot connect using SQL*Plus.
I can connect using the broser User Interface though, which I was able to do after doing the following procedure to change the password of the sys account:
- open a command prompt
- - type sqlplus
- On the “Enter user-name” line, type /as sysdba
- On the SQL> prompt, type alter user sys identified by NewPassword;
But the thing is that even though I am able to connect using sys/NewPassword from my browser UI, I dont get the same result when doing it using the SQL prompt.
What I am trying to do is this:
SQL> connect sys/NewPassword
Then I get first a warming saying that I need to use either sysdba or sysoper to connect to the system account, but neither of those work.
Can anyone advice me on this matter?
Thanks in advanceThanks for that.
I run the command to list the usernames on the database and I got SYS and SYSTEM in the list. But again, when I try to use SYS with a password that I know is working because I can access it through the browser UI, it doesnt work. It seems like this sys is different to the sys I used in the UI.
I dont know if I am explaining myself correclty... In the Browser UI I use sys, and a password and I get connected to the sys account. However, if I try to use the same sys.password combination from my sqlplus prompt, I get error messages
Does this make sense at all? -
Inserting Special Character using SQL*Plus
I am trying to insert special character like ® using SQL*Plus but it is inserting a .(dot) instead.
Environment:
Oracle Enterprise version : 9.2.0.3.0
Sun Solaris 8
Any help will be appreciated.
Regards,
NirmalyaThat's the reason I use ASCII values always for special characters.
SQL> create table sample1(col1 varchar2(50))
2 /
Table created.
SQL> insert into sample1
2 select 'The temperature outside is 20'||chr(176)||' centigrade' col1
3 from dual
4 /
1 row created.
SQL> commit
2 /
Commit complete.
SQL> select * from sample1
2 /
COL1
The temperature outside is 20° centigrade
1 row selected.
SQL> drop table sample1 purge
2 /
Table dropped.
SQL> Cheers
Sarma. -
11g: can connet using SQL*PLUS, not with TOAD
Hi
I run into a problem with TOAD. I can't connect with my 11g database using TOAD. I don't get any messages it just gives me a little waiticon for a split second and then nothing happens. I can however connect to my 10g database using TOAD. Using SQL*Plus I can connect to both.
I use TOAD 8.6. Do I need a newer version maybe??...I can connect like:
hr/pw@xe
or
hr/pw@O11R1
or directly, no problem. I can connect from SQLplus to both databases any way I want -
Can I use SQL *Plus 11.1.0.7.0 to connect Oracle Express 10g
Hi guys:
I download "Oracle 11g ODAC *11.1.0.7.20* with Oracle Developer Tools for Visual Studio", trying to use SQL *plus to see if configuration is alright.
But after entering account/pwd, I got a error:
ORA-12560: TNS:protocol adapter error
What is wrong with my environment?
Thanks,
Rickyuser12086319 wrote:
Hi EdStevens,
Following the instructions in previous post, I can connect with SQL plus (the database is on the same box* as your sqlplus client); I just enter sqlplus in windows console.
In addition, i am still curious about how SQL plus connect to a remote* box. Could you shed more light on that?SQLPlus connects to a remote db the same way any other app does. After all, sqlplus is just another client app.
It's all in the connect string. So say, at a command prompt you enter
$> sqlplus scott/tiger@mydbso in the above example, 'scott' is the user, 'tiger' is the password, and 'mydb' is the tns service name. Of course, the OS passes all that to sqlplus as a command line parameter. Internally, sqlplus makes a call to the tns layer and passes it the connect information it has. TNS will take a look at the tnsnames.ora file and find an entry for 'mydb', and from there it will get the name or ip address of the host server, a port number, and a service name. That information will be passed on down the network stack for routing. (If a name was provided instead of an ip address, the OS network stack will use whatever means are at its disposal - a hosts file, a dns lookup, or whatever, to get an ip address). The request will arrive at the specified host and placed on the specified port. If everything was configured correctly, there will be an oracle listener process monitoring that port. It will pick up the request and see if it recognizes the service name. If it does, it will spawn a user server process on a different port to complete the connection, then get out of the way and continue listening for more requests.
This is how it happens most of the time. There are a lot of other variants, but that's the gist of it.
More information can be found in the fine documentation at tahiti.oracle.com. -
Modifying Stored Procedue Using SQL Plus
Can you modify an existing procedure using SQL Plus?
you can write your own "editor"
editproc.sql
set feedb off echo off termout off head off trimsp on lin 10000 pages 0
spool tmpproc.sql
select dbms_metadata.get_ddl('PROCEDURE','&1') p from dual;
spool off
get tmpproc nolist
ed
set feedb 6 termout on
/than, to edit procedure P in sqlplus
SQL> @editproc P
(... edit it ...)Procedure created.
SQL> -
How to Custom Report using sql server report builder for SCCM 2012 SP1
Hi ,
I am new to database, if i want to create a manual report using sql server report builder for SCCM 2012 SP1, what step should i take.
i want to create a report in which computer name, total disk space, physical disk serial no come together. i already added class (physical disk serial no.) in hardware inventory classes. refer snapshotHi,
Here is a guide on how to create custom reports in Configuration Manager 2012, it is a great place to start, change to the data you want to display instead.
http://sccmgeekdiary.wordpress.com/2012/10/29/sccm-2012-reporting-for-dummies-creating-your-own-ssrs-reports/
Regards,
Jörgen
-- My System Center blog ccmexec.com -- Twitter
@ccmexec -
Listener is listening but when we use sql*plus ORA-12203
Hi all,
listener is listening but when we use sql*plus ORA-12203
we are trying to connect oracle database in VPN, all the configuration is ok, the listener is listening at db-server site with 1521
we can connect with tnsping, but when we connect with
sqlplus it not going through. any boidy has experienced this. any one can help?
Thanks in advanceTNSNAMES.ORA file is
it works when i try with serice name factory through LAN, then im disconnectinag at LAN and try through VPN, it doesnt go.
here is TNSNAMES.ORA copy .
Beq-local.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = beq.world)
(PROTOCOL = BEQ)
(PROGRAM = oracle73)
(ARGV0 = oracle73ORCL)
(ARGS = '(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))')
(CONNECT_DATA = (SID = ORCL)
Tcp-loopback.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 127.0.0.1)
(Port = 1521)
(CONNECT_DATA = (SID = ORCL)
Example1.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = Production1)
(Port = 1521)
(CONNECT_DATA = (SID = SID1)
Example2.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = spx.world)
(PROTOCOL = SPX)
(Service = Server_lsnr)
(CONNECT_DATA = (SID = ORCL)
Example3.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = nmp.world)
(PROTOCOL = NMP)
(Server = FinanceServer1)
(Pipe = ORAPIPE)
(CONNECT_DATA = (SID = ORCL)
factory =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = DBSERVER)
(Port = 1521)
(CONNECT_DATA = (SID = MYDATABASE)
factory1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 172.27.32.22)
(Port = 1521)
(CONNECT_DATA = (SID = MYDATABASE)
) -
Help Using SQL*Plus Format Commands (like TTITLE) in Packages
Where (within a package) can/should SQL*Plus format commands such as TTITLE, COLUMN & BREAK be coded?
A package is coded in PL/SQL.
TTITLE, COLUMN and BREAK are SQL*Plus commands, they cannot be used in PL/SQL.
If you want to output data (using dbms_output) in your package, you'll have to implement the features yourself. But probably just using SQL*Plus is better in your case.
Regards,
Rob.
Maybe you are looking for
-
Sharepoint foundation 2013 on windows 8
Hi All Can we install Sharepoint foundation 2013 on windows 8 OS Regards Sivam
-
Why is the preview taking elements away and stretching the page?
I am running Mac Mountain Lion with Muse. I have a footer bar with an image in the middle. It shows up fine with my other pages but on the newest pages I make, it disappears and stretches the page out beyond my minimum page size.This only happens whe
-
Intunes will not install along with quicktime
i download the latest version of itunes and quicktime and when i try to install it i get an error about how quicktime can not read c:/windows/installer/quicktime.msi cannot read so any help would be greatly helped i have totally removed quick time an
-
Stmt.executeQuery() Problem
Hello All, The below statement is taking too long to respond. stmt.executeQuery(query) i donot think any problem with the query, but im not sure why it is taking too long. But Finally its executing after a long time. Can anybody help please. This is
-
Work bench request vs Customized request
Hi, what is the difference between work bench request and customized request and also let me know types of requsts. Thanks, Sreedhar.V.