Fetch tablespace data from Oracle database(HP UNIX server) to excel Sheet

Hi team,
I have 5 oracle databases and they all are on different machines. i want to fetch data(tablespace data) from db to excel.
here is my macro code
Sub tbs_STD()
Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim Cmd As New ADODB.Command
Dim sqlText As String
Dim Row As Long
Dim Findex As Long
Dim STD As Worksheet
Dim X As Long
Dim UID As String
Dim PWD As String
Dim Server As String
UID = "monitordb"
PWD = "monitor1"
Server = "STD"
Set STD = ActiveSheet
STD.Select
Conn.Open "PROVIDER=MSDAORA.Oracle;DATA SOURCE=" & Server & ";" & _
"USER ID=" & UID & ";PASSWORD=" & PWD
Cmd.ActiveConnection = Conn
Cmd.CommandType = adCmdText
sqlText = "select sum(a.tots/1048576) Tot_Size,sum(a.sumb/1048576) Tot_Free,round(sum(a.tots-a.sumb)*100/sum(a.tots),2) Pct_used,sum(a.largest/1024) Max_Free,sum(a.chunks) Chunks_Free from(select tablespace_name,0 tots,sum(bytes) sumb,max(bytes) largest,count(*) chunks from dba_free_space a group by tablespace_name union select tablespace_name,sum(bytes) tots,0,0,0 from dba_data_files group by tablespace_name) a group by a.tablespace_name order by a.tablespace_name"
Cmd.CommandText = sqlText
Set RS = Cmd.Execute
For X = 0 To 4 ' Number of columns returning minus 1
'Data.Cells(1, X + 1) = RS.Fields(X).Name
Next
Do While Not RS.EOF
Row = Row + 1
For Findex = 0 To RS.Fields.Count - 1
STD.Cells(Row + 2, Findex + 67) = RS.Fields(Findex).Value
Next Findex
RS.MoveNext
Loop
End Sub
I am able to connect through sqlplus on all machines but when i run the above code it gives me TNS error..
ORA-12154- TNS could not resolve the connect identifier specified..
Each database use same port 1527 and only one of them is able to fetch the data. and if i remove that database from client then the other one starts connecting. I think problem is due to same port number.
Entries in the listener.ora file was made throough oracle client only 32bit.
and i have installed both 10g and 11g client on my local machine.
Please help.

You need to configure tnsnames.ora in your OracleClient\network\admin folder with the TNS entries for the servers you're connecting to.

Similar Messages

  • To fetch data from Oracle Database

    Hi Gents,
    Any alternative option other than SQL to fetch data from Oracle DAtabase. ( My manager worked on Mainframes he is telling other than SQL there should be some options.. Gents pls guide if any options.......
    REgards
    Fento

    >
    Any alternative option other than SQL to fetch data from Oracle DAtabase. ( My manager worked on Mainframes he is telling other than SQL there should be some options.. Gents pls guide if any options.......
    >
    There is no other (supported) way to get data from Oracle Databases as SQL. No matter what third-party tool you use to access Oracle Databases, they all will use (embedded) SQL.
    In very rare cases, one must use tools to read from datafiles directly because the database got damaged and a proper recovery is impossible. That is an emergency solution and by no means a replacement for SQL access.
    In short: No :-)
    Kind regards
    Uwe
    http://uhesse.wordpress.com

  • FETCH DATA FROM ORACLE DATABASE USING Web Dynpro

    I want to fetch data from ORACLE database using Web Dynpro.How can I do this?

    1) Are you sure that you get no results? It sounds like you are having name resolution issues, which would imply that you should be getting an ORA-00942 error indicating that the table doesn't exist (or that you don't have access to the table). If you are not seeing this error, I would tend to suspect an overzealous exception handler.
    2) What database account owns the table? What database account is your ASP.Net application using to connect? Assuming these two accounts are different, your application would either have to
    - Explicitly prefix the table name with the schema name
    - Have a public or private synonym that maps the table name to the fully qualified identifier schema_name.table_name
    - Issue the command ALTER SESSION SET CURRENT_SCHEMA = <<schema name>> in each session, in which case all queries in the session would use the specified schema name as the default if no schema name is prefixed.
    Justin

  • How to extract data from oracle database directly in to bi7.0 (net weaver)

    how to extract data from oracle database directly in to bi7.0 (net weaver)? is it something do with EDI? can anybody explain me in detail?
    Thanks
    York

    You can use UDConnect to get from Oracle database in to BW
    <b>Data Transfer with UD Connect -</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/78/ef1441a509064abee6ffd6f38278fd/content.htm
    <b>Prerequisites</b>
    You have installed the SAP WAS J2EE Engine with BI Java components.  You can find more information on this in the SAP BW installation guide on the SAP Service Marketplace at service.sap.com/instguides.
    Hope it Helps
    Chetan
    @CP..

  • How to I convert data from oracle database into excel sheet

    how to I convert data from oracle database into excel sheet.
    I need to import columns and there datas from oracle database to microsoft excel sheet.
    Please let me know the different ways for doing this.
    Thanks.

    asktom.oracle.com has an excellent article on writing a PL/SQL procedure that dumps data to an Excel spreadsheet-- search for 'Excel' and it'll come up.
    You can also use your favorite connection protocol (ODBC, OLE DB, etc) to connect from Excel to Oracle and pull the data out that way.
    Justin

  • How to send a mail automatically based on a date from ORACLE database

    Hi,
    I want to send a mail automatically based on a date from ORACLE database.
    Please help me.
    thanks
    --Sara                                                                                                                                                                                                                                   

    programs are available on net to send mail directly from oracle ie procedure s in oracle sending mails

  • Walkthrough: Displaying Data from Oracle database in a Windows application.

    This article is intended to illustrate one of the most common business scenarios such as displaying data from Oracle database on a form in a Windows application using DataSet objects and .NET Framework Data Provider for Oracle.
    You can read more at http://www.c-sharpcorner.com/UploadFile/john_charles/WalkthroughDisplayingDataOracleWindowsapplication05242007142059PM/WalkthroughDisplayingDataOracleWindowsapplication.aspx
    Enjoy my article.

    hi,
    this is the code :
    public class TableBean {
    Connection con ;
    Statement ps;
    ResultSet rs;
    private List perInfoAll = new ArrayList();
    public List getperInfoAll() {
    int i = 0;
    try
    con = DriverManager.getConnection("url","root","root");
    ps = con.createStatement();
    rs = ps.executeQuery("select * from user");
    while(rs.next()){
    System.out.println(rs.getString(1));
    perInfoAll.add(i,new perInfo(rs.getString(1),rs.getString(2),rs.getString(3)));
    i++;
    catch (Exception e)
    System.out.println("Error Data : " + e.getMessage());
    return perInfoAll;
    public class perInfo {
    String uname;
    String firstName;
    String lastName;
    public perInfo(String firstName,String lastName,String uname) {
    this.uname = uname;
    this.firstName = firstName;
    this.lastName = lastName;
    public String getUname() {
    return uname;
    public String getFirstName() {
    return firstName;
    public String getLastName() {
    return lastName;
    ADF table code:
    <af:table value="#{tableBean.perInfoAll}" var="row"
    binding="#{backing_Display.table1}" id="table1">
    <af:column sortable="false" headerText=""
    align="start">
    <af:outputText value="#{row.firstName"/>//---> Jdeveloper 11g doesn't allow me to use this.. it says firstName is an unknown property..
    </af:column>
    </af:table>
    Please tell me is this the way to do it.. or is it a must to use the DataCollection from the data controls panel...
    Thanks...

  • Need to fetch the data from CMS database

    Hi All,
    I'm using BO XI 3.1 SP2 and looking for below data to retrieve:
    1. I would like to pull the data for universe as below and here my parameter would be my Universe name
    Groups
    Reports
    Groups: which are having access to that universe?
    Reports: Reports which are builds using that Universe
    2. Also the below data is required for the universe is:
    List of Users those are having access to universe. User active is user's status enabled or disabled. And last column is whether user is having permissions to edit the data provider or not.
    User ID
    User Name
    User Group
    User Active
    Data Provide Edit
    Please let me know how I could fetch this data from CMS database.
    Thank you..!!

    There is a spreadsheet in BOB forum under download that extracts the users and groups, etc fromt he CMS database.
    You can customize it to get the universes and reports.
    User ID - yes available
    User Name  - yes Available
    User Group - yes available
    User Active - yes available
    Data Provide Edit - I didn't see it in that spreadsheet but I am sure you can find it.

  • Want to see on screen data from oracle database using php

    I am struggling on the problem of echoing data from Oracle database (9i) to the screen for viewing. For ex. the data has records from various cities. when a particular city is inputted as prompt, all the records for the that city from the table should appear through PHP. Can someone help me?

    Thank you very much for giving the link. I tried and it is working. Only, I am still struggling with trying to get many fields from the database on the screen for viewing. Ex. a prompt to ask which country and which month. If I give India and December it must give all the data pertaining to India for December. This AJAX was very useful, as it gave lot of tips, but my basic query to see the data thru PHP from my database is still unsolved. Any help??
    Jacob
    Thanks once again for the help.

  • What is the easiest way to export all tables data from Oracle to MS SQL Server?

    Hello MS,
    I would like to export all tables from Oracle 11.2 to MS SQL Server 2012 R1.
    Using the tool "Microsoft SQL Server Migration Assistant v6.0 for Oracle" did not work for me because there are too many warnings and errors regarding the schema creation (MS cannot know it because they are not the schema designer). My idea is
    to leave/skip the schema creation to the application designer/supplier and instead concentrate on the Oracle data export and MS SQL data import.
    What is the easiest way to export all tables data from Oracle to MS SQL Server quickly?
    Is it:
    - the „MS SQL Import and Export Data“ Tool
    - the “MS SQL Integration Services” Tool
    - not Oracle dump *.dmp format because it is a propritery binary format
    - flat file *.csv (delimited format)
    Thanks!

    Hi lingodingo,
    If you want to directly export all tables from Oracle database to SQL Server, I suggest you use SQL Server Import and Export Wizard. Because you just need to follow the wizard with GUI, this is the easiest way.
    If you want to make some modification for the tables‘ data before loading to SQL Server, I suggest you use SQL Server Integration Services package. For more details, please refer to the following similar thread:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/38b2bed2-9d4e-48d4-a33f-1d9eed1c062d/flat-file-to-sql-server?forum=sqldatamining
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How can i extract data from oracle table  to flat file or excel spread shee

    Hello,
    DB Version is 10.1.0.3.0
    How can i extract data from oracle table to flat file or excel spread sheet by using sub programs?
    Regards,
    D

    Here what I did
    SET NEWPAGE 0
    SET SPACE 0
    SET LINESIZE 80
    SET PAGESIZE 0
    SET ECHO OFF
    SET FEEDBACK OFF
    SET VERIFY OFF
    SET HEADING OFF
    SET MARKUP HTML OFF SPOOL OFF
    Sql> SPOOL bing
    select * from -------;
    SPOOL OFF;
    I do not see file.
    I also tried
    Sql> SPOOL /tmp/bing
    select * from -------;
    SPOOL OFF;
    But still not seeing the fie,

  • How to create a DBlink from oracle database on unix to sqlserver

    Hi
    I need to create a database link from oracle database on solaris machine to sqlserver database.I found that the database link cannot be created from oracledatabase 10g to microsoft sqlserver.So i am planning to go for another windows server where i can pull this data from sqlserver to oracle 10g database on windows and then from windows to unix.
    Can you explain me how can i create a database link from orace 10g on windows to sqlserver.

    HI
    Thanks for your response.
    But the thing is i am looking whether if u can create a database link from oracle to sqlserver from unix.If that's the case what is the driver i require and if not how can i do it ?
    I am ready to create a intermediate windows server where i can pull the table temporarily and then from there to unix box.
    If i can do it windows how can i achieve that.
    Thanks

  • Retriving data from oracle database

    hi all,
    i have connected to oracle database  and i want retrieve data from that database.can u please give the procedure how to retrieve data and how to load it into info cube

    Hi,
    You can use either DB connect or UD connect for extracting data from external database.
    DB Connect:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2f0fea94-0501-0010-829c-d6b5c2ae5e40
    UD Connect:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/58f4db47-0501-0010-a2bf-ff01b150fdff
    Also please search in SDN, you will find lot of threads related to this topic.
    regards,
    Pruthvi R

  • Problem reading data from oracle database 11g using OleDbDataReader

    Hi everyone I work with Visual Studio 2010 and C# programming language. I have a problem reading data from the oracle database. I created a WPF application with my main Window Xaml and class files and 1 more class called DataFiles. The thing I want is to read some data from the database on my grid in my WPF window. Problem is even though it connects to the database the grid is always empty. It isn't the connection string as I tested it and it connects to the database the problem seems to be in showing the LASTNAME (PREZIME in my native tongue) on the grid which is what it's supposed to do.
    Here is the code:
    Data Files Code
    using System;
    using System.Collections.ObjectModel;
    using System.Data.SqlClient;
    using System.Data.OleDb;
    namespace SQLKonekcija
        public class clsEmployee
            public string Prezime { get; set; }
        public class DataAccess
            OleDbConnection oleCon;
            OleDbCommand oleComd;
            public DataAccess()
                string connectionString = "provider=ORAOLEDB.ORACLE; data source=ORCL; password=****; user id=****;";
                oleCon = new OleDbConnection(connectionString);
            public ObservableCollection<clsEmployee> GetAllEmployee()
                ObservableCollection<clsEmployee> EmpCol = new ObservableCollection<clsEmployee>();
                oleComd = new OleDbCommand();
                oleComd.Connection = oleCon;
                oleComd.CommandText = "Select PREZIME from UPOSLENICI";
                oleCon.Open();
                OleDbDataReader Reader = oleComd.ExecuteReader();
                Reader.Read();
                while (Reader.Read())
                    EmpCol.Add(new clsEmployee()
                        Prezime = Reader["PREZIME"].ToString()
                oleCon.Close();
                return EmpCol;
            }And here is my main window.cs code
    public partial class MainWindow : Window
            clsEmployee objEmpToAdd;
            DataAccess objDs;
            public MainWindow()
                InitializeComponent();
            private void Window_Loaded(object sender, RoutedEventArgs e)
                objDs = new DataAccess();
                dgEmp.ItemsSource = objDs.GetAllEmployee();And the XAML
    <Window x:Class="SQLKonekcija.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
        <Grid>
            <DataGrid AutoGenerateColumns="False" Height="237"
                      HorizontalAlignment="Left" Margin="18,66,0,0" Name="dgEmp"
                      VerticalAlignment="Top" Width="466" ColumnWidth="*"
                       >
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding PREZIME}" Header="Prezime"></DataGridTextColumn>
                </DataGrid.Columns>
            </DataGrid>
            <TextBlock Height="42" HorizontalAlignment="Left" Margin="18,15,0,0" Name="textBlock1" Text="TEST CONNECTION" VerticalAlignment="Top" Width="462" TextAlignment="Center" FontSize="28" FontWeight="ExtraBold" />
        </Grid>
    </Window>
    The guys on the MSDN forums told me I should ask the question here so sorry if it's not your field.
    Hope u guys can help, thanks.

    I tried it, commented out the reader.read and have the following connection string
    string connectionString = "provider=ORAOLEDB.ORACLE; data source=ORCL; password=****; user id=****; OLEDB.NET=True"
    Unfortunately the result is the same.
    Edited by: Dino2dy on Nov 24, 2011 12:53 AM

  • Import data from oracle database table into csv file

    Hi
    I have to import data from a table into a csv file. Could anyone suggest the best method to do it? My application is JSP as frontend and have put business logic in servlet.
    Thanks in advance.

    FastReader from wisdomforce will help you quickly export data into csv file. http://www.wisdomforce.com
    fastreader can be called and executed as an external process ( Runtime.exec(..) ) to extract data from Oracle tables into flat file

Maybe you are looking for

  • Why do I have to click on all of my flash components before I can navigate?

    Without modification to the code...the component is there but it needs to be clicked on before I can navigate the site. Should Dreaweaver not know how to properly insert the code necessary allow the flash component to view properly? What am I missing

  • Corrupt Boot disc - how do I boot from OSX disc to run Repair Disc?

    I have just run Verify Disc and it has identified problems which requires me to boot from my OSX disc and run Repair disc. I think I do this by switching on while holding down C....is that right? ALSO I can only find my Leopard boot discs and I am cu

  • I can only run Sun Java Studio Enterprise 8 as root

    I ran into the same problem, and checked the $HOME variable and they do expand to user-specific directories for root and initial user respectively. I installed it originally in the /opt directory, then removed it after it would only let me run the pr

  • Get started with ABAP

    Hello Everyone, I started learning ABAP few days ago (my ABAP knowledge is zero), I went thru Amazon and there're millions of ABAP tutorials / books. Any recommended book for a starter like me? I do have SAP ECC 6.0 or 4.7 to practice and really need

  • History in Camera Raw ?

    Is there a history brush in Camera Raw ?   I am using CS6  In photoshop there is a history brush...but don't see one in Camera Raw.   How do I go back?  Thanks, Penni