How to check remote Oracle server is up and running - oracle10g

I have my Oracle server installed in a remote machine and I want a script at my local machine which will check whether Oracle server is up and running or not. I know this can be check by creating a connection through sqlplus or JDBC. But in this case oracle client won't be present and I am saving JDBC approach as my last option. So is there any other simpler way to check this, which can be easily implemented in a shell script???
Thanks

Not really. The only way to be certain that the database is responding to queries is to run a query on it, such as the venerable:
select dummy from dual

Related

Does Postgres use local resources when connecting to a server?

I am new to Postgres and wanted to understand if i make a remote server for Postgres and use PGadmin to connect to the remote server, will it use local resources to run the queries?
I tried it on a user machine here and it seems to be the case and would like the queries submitted to be run on the server itself and not consume local resources. Any suggestions would be helpful.
Thanks
Saurabh
No, the query is run on the server. However the download and the display of the results can take some time and can take ressources on the client, depending on the size of the result set.

Is it possible to connect to a PostgreSQL server using FreeTDS driver and tsql?

I've asked this question on serverfault and someone told me to ask here.
Can I make a connection to a PostgreSQL server using FreeTDS, more specifically using the tsql command?
I've been trying for a few days now, using many different configurations. Even though I am able to connect to the DB using isql and PostgreSQL odbc driver, I can't make it work using tsql (it also doesn't seem to use odbc.ini or odbcinst.ini). So, I was wondering if the tsql command only works with SQL Server.
If you want, I can post the files freetds.conf, odbc.ini and odbcinst.ini.
Thanks.
FreeTDS only supports the TDS protocol (hence the name). And this protocol is only implemented by Microsoft SQL Server and the Sybase database.
So, no you can not use FreeTDS to connect to a Postgres database.
You need to use the Postgres ODBC driver, the Postgres .Net driver or the Postgres JDBC driver to do this - depending on the programming language of your application. From a C program you can also connect to Postgres directly using the libpq library.

Setting up environment for SQL queries

I know the basic syntax of queries but otherwise I'm a beginner with SQL.
I have an SQL file (.sql) and I downloaded a couple programs (pgadmin and sql workbench).
I have no idea how to get from where I am now to actually writing queries and finding information. How do I set up so I can actually import my SQL file and start writing queries?
pgAdmin is the default GUI for PostgreSQL.
SQL Workbench is a free, DBMS-independent, cross-platform SQL query tool.
Either way, you need to connect to a database to actually run queries. The DBMS can either run on your local machine or you can connect to a remote server - where you need access privileges of course.

How does ODBC pull database connection details?

I currently have a Macro which is connecting to a sybase database using ODBC. It's making the connection by running the following:
Set conX = wrkODBC.OpenConnection("Connection1", , True, strConn)
where strConn = "ODBC;DSN=Server_Name;APP=Daily Task;DB=db_name;UID=uname;PWD=pwd;"
The problem I am having is that this connection is working for some Server_Name's but not others. When it doesn't work I get a Error "3146 - ODBC--call failed".
What I don't understand is where it is pulling the server details from. So for example, when using embarcadero rapid to connect to a sybase database, it will use the sql.ini file to pull the server connection details based on the server_name.
I have checked and all the Sybase Servers I am testing are in the sql.ini file and my env variables are pointing to the correct sybase version. I've checked ODBC and it is only picking up a SQL Server driver.
Can anyone please explain how ODBC pulls the server name connection details? I don't understand why it works for some server names, but not others (FYI, I have tested the uname and pwd is rapid to make sure it is correct).
Any information would be much appreciated.
So, the issue was that I was looking at my odbc connections under control panel. I should mention that I am on windows 7. What I had to do was update my ODBC connection details here:
C:/Windows/SYSWOW64/odbcad32.exe
--This is for 32bit!
This had some connections set up which is why I could connect to some servers but not all of them.

How to connect to particular database in Oracle 10g

Suppose I have multiple Oracle databases in the same server. Now I want to connect to particular database and query a table just like SQL Server 2008. How to start particular Oracle database?
If you are using SQL*Plus, the most common syntax for opening a connection is
sqlplus user_name/password#tns_alias
In this example TNS_ALIAS is the TNS alias for the particular database you want to connect to (most likely "XE" based on your followups to inium's answer). If you want to connect to a different database, you would need to specify a TNS alias for that specific database.
Note that since you are coming from a SQL Server background, the SQL Server definition of a database is rather different than the Oracle definition. What SQL Server calls a database is similar logically to what Oracle calls a schema (and similar physically to what Oracle calls a tablespace). So when you're dealing with Oracle, it's much more common to have many schemas in a single database than to have a large number of databases on a server. This is particularly true if you're using the Express Edition (Oracle XE) where you're generally limited to one database per machine.
go to cmd and type sqlplus <database-name>/<database-password>
You can use SQL Developer, it's similar to SQL Enterprise Manager 2005. Just create a new connection using the db user name and password.