Database name from OS level
Hi ,
How can i know the name of the database running from OS prompt
on unix check with ps command, on wndows check the services.
rgds
Similar Messages
-
Service name from user level through any query
Hi
One of my user want to find the oracle service name through SQL query from user level. This user is not a DBA.
With DBA privs this querry
SELECT NAME, VALUE FROM V$PARAMETER WHERE NAME = 'service_names';
brings the correct result. But user he will not have the access to read the V$PARAMETER table which is part of sys object.
select sys_context('USERENV','SERVICE_NAME') from dual;
SYS_CONTEXT('USERENV','SERVICE_NAME')
SYS$USERS
this query is not giving my the correct result. Is there any way we can grab the service name from user level.
Your cooperation is highly appreciated.
Raoselect sys_context('USERENV','SERVICE_NAME') from dual;You need to note that the result of the above depends on how you connect to the database. If you connect using NET Service, it should give you the SERVICE_NAME.
SQL> conn sys as sysdba
Enter password:
Connected.
SQL> show parameters service_name
NAME TYPE VALUE
service_names string testdb
SQL> select sys_context('USERENV','SERVICE_NAME') from dual;
SYS_CONTEXT('USERENV','SERVICE_NAME')
SYS$USERS
SQL> conn sys@testdb as sysdba
Enter password:
Connected.
SQL> select sys_context('USERENV','SERVICE_NAME') from dual;
SYS_CONTEXT('USERENV','SERVICE_NAME')
testdb
SQL> conn scott@testdb
Enter password:
Connected.
SQL> select sys_context('USERENV','SERVICE_NAME') from dual;
SYS_CONTEXT('USERENV','SERVICE_NAME')
testdb
SQL> conn scott
Enter password:
Connected.
SQL> select sys_context('USERENV','SERVICE_NAME') from dual;
SYS_CONTEXT('USERENV','SERVICE_NAME')
SYS$USERS
SQL>
So you need to understand the use of sys_context -
How can I get a list of database names from environment
Hi,
How can I get a list of database names from environment.
I had found a method in JE API Docs named Environment.getDatabaseNames(), and i couldn't found the same method in Berkeley DB.
I use java interface, is it supported?
Thanks.Hello,
I don't know if it would work for you, but have you checked the db_archive utility at:
http://download.oracle.com/docs/cd/E17076_01/html/api_reference/C/db_archive.html
Check the -s option.
Thanks,
Sandra -
Views to check the catalog database name from target database.
Hi,
Please help me to find view to check the catalog database name which is connected to my target database because I am new to the current environment where I am working now and the previous DBA have done the set up having 2 catalog database. I want view to check from target database, which can show the catalog database name to which it is connected to.
We can check the catalog database name from the following ways but I want views to check it from target database.
1.TNSnames.ora
2.Any backup script connecting to catalog database.
3.From catalog database we can use rc_database view to check the databases registered with the catalog database.Please help me to find view to check the catalog database name which is connected to my target databaseYou can check for any RMAN backup jobs that been scheduled on the server.
In the scheduled script check rman command.
You can then identify the database alias (of the catalog db) that is used in the rman backup script.
Once you have found the database alias, check for the database alias entry in tnsnames.ora file present in your target database server.
Once the entry is found, you can find the IP address and catalog db name from the tns entry.
Edited by: st. osh on Nov 22, 2012 11:38 PM -
How to remove database name from SQL query
We have an MS SQL server with several databases that are of the same schema but have different data. We do this for testing different environments. We are using Crystal reports for the first time and we are having trouble changing the database location in the designer. If update the data source location to the same database server, but different database name, the data still comes from the original database used when creating the report. We look at the SQL query and it contains the database name and does not change when updating the data source. Therefore the data always comes from the database used when originally creating the report.
How can I remove the database name from the SQL query so the proper database is used when testing the report?Hi C F
Please ensure you have followed the procedure mentioned below:
In Crystal Reports, there are two ways to set the location of the data source your report points to, depending on your connection type.
For ODBC and Native Connections:
1. On the 'Database' menu, click 'Set Datasource Location'.
2. In the 'Current Data Source' section, click the data source to be changed. You must click each individual table in the data source one by one. If the data source is a stored procedure you will not see individual tables.
NOTE In Crystal Reports 10, XIR1, and XIR2, if you are mapping from a data source such as a stored procedure where the report designer can not determine which fields should be mapped automatically, you will see a 'Mapping' dialog box where you can manually map fields, as in the procedure cited above.
3. In the 'Replace with' section, click the data source you want the report to use.
4. Click 'Update'.
5. Close the 'Set Datasource Location' window.
The report now points to the new location.
For Native Connections Only:
1. On the 'Database' menu, click 'Set Datasource Location'.
2. In the 'Current Data Source' section, click 'Properties' to expand it and right-click 'Database Name: <path to database>'.
3. Click 'Edit' and then type the path to the
new data source location.
4. Close the 'Set Datasource Location' window.
The report now points to the new location.
Regards
Girish -
Query to identify the recovery catalog database name from target database
Hi,
How to get the recovery catalog database name from the registered target database?
i dont know my recovery catalog database for my target database.
I know we can use the query
select * from rc_database;
from recovery catalog database to know all the registered database with the recovery catalog but I want to know is there any way or query to identify the recovery catalog database name from target database to which the target database is registered
With Regards
Boobathi PYou can check the backup scripts which you use to backup your target database to get the catalog database name.
And check the corresponding connect string in TNSNAMES.ORA file or tnsping to get the server details of the catalog database.
Edited by: gopal on Apr 12, 2013 12:59 PM -
View to Find Primary database name from Standby
Is there any way(view) we can find the primary standby database name and it's host from the standy database.
Thanks,V$DATABASE holds the Database Name and this would be the same on the Standby as on the Primary -- at least would be the same for a Physical Standby, I haven't done or verified a Logical Standby with a different DB_NAME.
However, the Host name is not a property of the database but of the instance -- an RAC database can have instances running on multiple hosts. Therefore, the HOSTNAME is always in V$INSTANCE only -- and that, of course, is different on the Standby then on the Primary. -
Want to know database name from RMAN prompt
Hi there
I want to know database name when I am in RMAN prompt.
Regards
JewelCopyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target /
connected to target database: SYSLOG (DBID=3659208352)
Here SYSLOG is the database name
Regards
Asif Kabir
user623166
Handle: user623166
Status Level: Newbie
Registered: Mar 2, 2008
Total Posts: 42
Total Questions: *18 (18 unresolved)*
Name jewel_bd
Occupation DBA
-- mark your helpful post as correct/helpful and close all the answered threads. -
Hide database names from unauthroized users in SSMS
If a user is not authorized to see a database can I exclude that database from even appearing in Management Studio for that user
TIA,
BarkingdogThis is what I ended up doing:
--SQL 2005
If @@version like 'Microsoft SQL Server 2005%'
Begin -- Create Login only if it doesn't exist:
IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE [name] = @Username)
Begin
Set @dsql ='create login ' + @Username + ' with password = N'''+ REPLACE(@password, '''', '''''') + ''', DEFAULT_DATABASE=' + QUOTENAME(@DBName) + ', CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF'
execute (@dsql)
set @dsql = 'use master; GRANT CONNECT SQL TO ' + QUOTENAME(@DBName)
execute( @dsql )
End
--Deny ability to see anything other than master, tempdb and user database.
Set @dsql = 'use master; deny VIEW any DATABASE to ' + @Username
--Print @dsql
execute (@dsql)
End
--Add user as dbo to database.
Set @dsql = @DBName + '.dbo.sp_changedbowner ' + @Username
--Print @dsql
execute (@dsql)
But, I don't think you can grant multiple user's to DBO, so you will only have one user that can see master, temp, and their database.
-Chuck Lathrope -
Database Name from Full Client
How can we know the Universe parameters from Full Client. I donu2019t have an access to Designer and Supervisor(BO 6.5). I am using desktop Intelligence to run a particular report and I want to know from which database(schema) the report is fetching the data.
Hello,
the Data Provider function "Connection" returns a string with various parameters.
Parse/search for the substring "DATABASE=".
HTH, best regards
Thomas -
How to Change Crystal Report database name from visual basic code?
Hi all,
I have created a Crystal Report (CR) with .NET VB. I also have developd some UDTs for that pusrpose and everything is OK.
However I cannot use the same CR in another Company which has the same UDTs. I have not found how Connect to Company (in other words change the DB the report reads).
Any Idea?
Thanks,
Vangelis
Edited by: Vangelis Kanellopoulos on Jul 19, 2008 6:07 PM
Edited by: Vangelis Kanellopoulos on Jul 20, 2008 10:27 AM
Edited by: Vangelis Kanellopoulos on Jul 20, 2008 10:28 AMHi Vangelis,
Here's a simple VB class that has functions for setting the login details for the report and passing parameters.
Option Strict Off
Option Explicit On
Public Class CrystalFunctions
Enum ParamType As Integer
Int
Text
End Enum
Public Shared Sub SetCrystalLogin(ByVal sUser As String, ByVal sPassword As String, ByVal sServer As String, ByVal sCompanyDB As String, _
ByRef oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)
Dim oDB As CrystalDecisions.CrystalReports.Engine.Database = oRpt.Database
Dim oTables As CrystalDecisions.CrystalReports.Engine.Tables = oDB.Tables
Dim oLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim oConnectInfo As CrystalDecisions.Shared.ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo()
oConnectInfo.DatabaseName = sCompanyDB
oConnectInfo.ServerName = sServer
oConnectInfo.UserID = sUser
oConnectInfo.Password = sPassword
' Set the logon credentials for all tables
For Each oTable As CrystalDecisions.CrystalReports.Engine.Table In oTables
oLogonInfo = oTable.LogOnInfo
oLogonInfo.ConnectionInfo = oConnectInfo
oTable.ApplyLogOnInfo(oLogonInfo)
Next
' Check for subreports
Dim oSections As CrystalDecisions.CrystalReports.Engine.Sections
Dim oSection As CrystalDecisions.CrystalReports.Engine.Section
Dim oRptObjs As CrystalDecisions.CrystalReports.Engine.ReportObjects
Dim oRptObj As CrystalDecisions.CrystalReports.Engine.ReportObject
Dim oSubRptObj As CrystalDecisions.CrystalReports.Engine.SubreportObject
Dim oSubRpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
oSections = oRpt.ReportDefinition.Sections
For Each oSection In oSections
oRptObjs = oSection.ReportObjects
For Each oRptObj In oRptObjs
If oRptObj.Kind = CrystalDecisions.Shared.ReportObjectKind.SubreportObject Then
' This is a subreport so set the logon credentials for this report's tables
oSubRptObj = CType(oRptObj, CrystalDecisions.CrystalReports.Engine.SubreportObject)
' Open the subreport
oSubRpt = oSubRptObj.OpenSubreport(oSubRptObj.SubreportName)
oDB = oSubRpt.Database
oTables = oDB.Tables
For Each oTable As CrystalDecisions.CrystalReports.Engine.Table In oTables
oLogonInfo = oTable.LogOnInfo
oLogonInfo.ConnectionInfo = oConnectInfo
oTable.ApplyLogOnInfo(oLogonInfo)
Next
End If
Next
Next
End Sub
Public Shared Sub SetCrystalParams(ByVal sFieldName As String, ByVal iDataType As ParamType, ByVal sVal As String, ByRef oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)
Dim oFieldDefs As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
Dim oFieldDef As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
Dim oParamVals As CrystalDecisions.Shared.ParameterValues
Dim oDiscreteVal As CrystalDecisions.Shared.ParameterDiscreteValue
oFieldDefs = oRpt.DataDefinition.ParameterFields
oFieldDef = oFieldDefs(sFieldName)
oParamVals = oFieldDef.CurrentValues
oParamVals.Clear()
oDiscreteVal = New CrystalDecisions.Shared.ParameterDiscreteValue()
Select Case iDataType
Case ParamType.Int
oDiscreteVal.Value = System.Convert.ToInt32(sVal)
Case ParamType.Text
oDiscreteVal.Value = sVal
End Select
oParamVals.Add(oDiscreteVal)
oFieldDef.ApplyCurrentValues(oParamVals)
End Sub
End Class
And here's how you would use them:
' Create an instance of the Crystal report
_rptCrystal = New CrystalDecisions.CrystalReports.Engine.ReportDocument()
_rptCrystal.Load(_oSBO.AddonPath + "\Reports\MyReport.rpt")
' Call SetCrystalLogin to see the logon information for all report tables
CrystalFunctions.SetCrystalLogin(sUser, sPassword, _oSBO.SboCompany.Server, _oSBO.SboCompany.CompanyDB, _rptCrystal)
' Set my report parameter value
CrystalFunctions.SetCrystalParams("MyParam", CrystalFunctions.ParamType.Int, 999, _rptCrystal)
' Print the report straight to the printer
_rptCrystal.PrintToPrinter(1, False, 0, 0)
The other way to approach this solution would be to base your Crystal report on a .NET dataset rather than a database connection. However, as you've already written your report, the code above is going to be simpler to implement.
Kind Regards,
Owen -
How can find the reposite database name connection
I have a obiee server installed, how can I find the reposite schema database coneection? -thanks
Hi,
You can create Repository Static Variable in rpd, and in Connection pool you can mention like VALUEOF(OLAP_DSN) and VALUEOF(OLAP_USER) in DSN and user name.Then create a report and change the function to use these variable.
fyi..refer:
http://oraclebi.blog.com/tip-of-the-day-checking-the-dsn-name-and-user-name-from-report-level/
Thanks
Deva -
Find Database name through scripts
Hi ALL,
I have a solaris box with 10 Database are running on that.
i am wrirting some scripts on that box to do some activity. So From OS level i am fetching the database name like this.
Ps -ef | grep smon
Now i want to startup all my 10 database to single script.( now database is down).
So in this level how can i fetch the database name in OS level.
Kindly give some ideas....
MAny Thanks
Senthil KumarSenthil,
The Oracle provided script dbstart starts all databases in /var/opt/oracle/oratab.
Likewise the Oracle provided script dbshut shuts down all databases mentioned in this file.
Please don't reinvent the wheel.
Sybrand Bakker
Senior Oracle DBA -
Hi Gurus
I am using oracle 10g on Windows platform. The issue is I need to change my database name. When i gone through the Oracle docs I found there is an utility called 'DBNEWID' . But not getting a clear cut idea. Since my DB is So critical anybody please tell me the exact steps to change the DB-Name.
Thanks & Cheers
AntonyChanging Only the Database Name
C:\>SQLPLUS/NOLOG
SQL*Plus: Release 10.1.0.2.0 - Production on Tue Aug 22 10:54:38 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL> CONN / AS SYSDBA
Connected.
SQL> SELECT DBID,NAME FROM V$DATABASE;
DBID NAME
1230404613 DB01
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
Must be : Take Whole Database Backup (Oracle Recommended)
Otherwise u lost ur database.
SQL> STARTUP MOUNT;
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145488364 bytes
Database Buffers 25165824 bytes
Redo Buffers 524288 bytes
Database mounted.
--Go Command Prompt
DBNEWID UTILITY >>>NID ( OS Path : d:\oracle\product\10.1.0\db_1\bin\nid)
C:\>SET ORACLE_SID=DB01
C:\>NID TARGET=SYS/ORACLE@DB01 DBNAME=ORADB01 SETNAME=YES
DBNEWID: Release 10.1.0.2.0 - Production
Copyright (c) 2001, 2004, Oracle. All rights reserved.
Connected to database DB01 (DBID=1230404613)
Connected to server version 10.1.0
Control Files in database:
D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\CONTROL01.CTL
D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\CONTROL02.CTL
D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\CONTROL03.CTL
Change database name of database DB01 to ORADB01? (Y/[N]) => Y
Proceeding with operation
Changing database name from DB01 to ORADB01
Control File D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\CONTROL01.CTL - modified
Control File D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\CONTROL02.CTL - modified
Control File D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\CONTROL03.CTL - modified
Datafile D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\SYSTEM01.DBF - wrote new name
Datafile D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\UNDOTBS01.DBF - wrote new nam
e
Datafile D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\SYSAUX01.DBF - wrote new name
Datafile D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\USERS01.DBF - wrote new name
Datafile D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\TEMP01.DBF - wrote new name
Control File D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\CONTROL01.CTL - wrote new
name
Control File D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\CONTROL02.CTL - wrote new
name
Control File D:\ORACLE\PRODUCT\10.1.0\ORADATA\DB01\CONTROL03.CTL - wrote new
name
Instance shut down
Database name changed to ORADB01.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
Set the DB_NAME initialization parameter in the initialization parameter file (PFILE) to the new database name.
Note:
The DBNEWID utility does not change the server parameter file (SPFILE). Therefore, if you use SPFILE to start your Oracle database, you must re-create the initialization parameter file from the server parameter file, remove the server parameter file, change the DB_NAME in the initialization parameter file, and then re-create the server parameter file.
---Create New Password File
cmd>orapwd file=d:\oracle\product\10.1.0\db_1\database\pwddb01.ora password=oracle entries=5
SQL> STARTUP PFILE=D:\Oracle\product\10.1.0\Db_1\database\initdb01.ora
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 145488364 bytes
Database Buffers 25165824 bytes
Redo Buffers 524288 bytes
Database mounted.
Database opened.
SQL> select dbid,name from v$database;
DBID NAME
1230404613 ORADB01
Note:
After Change DB Name Take Whole Database bkp.
Note: If i am missing some step or write wrong step plz. correct me.
Before doing this refer documentation.
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14215/dbnewid.htm
thanx
Message was edited by:
user526020
null -
Refresh tool and table name containing database name in Mysql
Hi,
when refreshing the database schema and my table name contains a database name (for example "my_other_db.my_other_table"), the refresh tool never sees weather "my_other_db.my_other_table" already exists or not. so it always generates a create-table-statement (which is syntactically correct, but of course fails, because that table exists already).
Is there known workaround for it? I am using Mysql 5.0.x, jdbc driver 5.0.7, Kodo 4.1.4 (but this problem was there before).
Right now i'm deleting the database names from my package.jdo-files, then doing the refresh command and after that i put back the database names. At runtime Kodo works very well with the database name before the table name.
Thanks very much,
Markus1. For WBS element under consideration, get OBJNR from PRPS table
2. Get PO numbers from COEP where OBJNR = PRPS-OBJNR obtained in step 1
Maybe you are looking for
-
i have installed j2sdk.. its working properly. Then while installing apache tomcat it asks the jvm path. I specified the jre folder in j2sdk. but it gives the error "No JVM found". so what to do??
-
I am trying to edit an My existing html site with a fluid grid layout. My Layout toolbar doesn't show a fluid grid div widget, and when I go to the 'Insert:Layout' menu, the fluid grid option is also gone. It used to be there. How do I get it back
-
hi, Are the images required for the new add-ons site of the same size and formats as previously applied to the Extensions Exchange? If not, can the (neat) original Adobe Exchange Assets template (Photoshop file) be updated? And, how about animated gi
-
How to create a Number range?
Hi, How to create a number range for a field to give our own number for a field?
-
How do I reinstall CS 6 web premium?
I own CS Web Premium and I need to install it in a new laptop. There is a not a place that I find for re-installs. I have my product key