I want to monitor Oracle database using SQL queries from internal tables. Are there any differences between Oracle for UNIX/Windows/Linux/OS?
In particular, do these tables exist and have the same structure in every platform? Do they change between 10g and 11g?
V$SYSSTAT
V$SESSTAT
v$session
I don't have access to test environments of production systems to check the tables differences.
Yes, internal system views for the same Oracle version are the same on different platforms.
System views might be different between Oracle releases.
You can look for the information in Oracle documentation. It's hard to find anything there but since it's published on-line you can use Google or any other search engine and search for "Oracle 10g V$SYSSTAT", "Oracle 11g V$SYSSTAT", etc.
For instance, docs for V$SYSSTATon 10g show the table exists and gives a list of column names, types and other relevant details. It doesn't mention that this information depends on the OS so we can assume it's universal.
Related
I have a SQL query I want to optimize, so I asked the database owner what version of SQL they were using (since ordinary methods didn't seem to have support). They answered that my version of SQL is not decided by them but by my local SQL client. They claimed to use a system called "DB2", with support for multiple SQL dialects.
I then went on to ask our IT department which version of SQL our client was using (that client being Squirrel SQL). After some fiddling around they logged on to the database, queried it and reported the version of SQL to be DB2.[sequence of decimals].
This is probably a stupid question, but would someone mind clarifying this?
Is the version of SQL I'm using determined by the database I'm accessing or by my SQL client?
If the version of SQL is decided by the database, then which version of SQL is DB2 associated with? Does it use its own version?
"They answered that my version of SQL is not decided by them but by my local SQL client"
That's complete and utter nonsense - those people apparently have no idea what they are talking about.
The SQL dialect that is understood by the server is only defined by that server. The client has absolutely nothing to do with that. If the database server doesn't support some specific feature, no SQL client will change that.
There is an industry standard called ANSI SQL that database vendors implement. Then on top of that they tack on non-standard proprietary stuff, extra commands, keywords, procedural stuff like stored procedures and triggers and cursors, that are not covered by a standard but which they expect will provide useful features that will differentiate them from the competition.
For Db2 11’s compliance with standards see https://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.common.doc/doc/c0011215.html. The actual spec is behind a paywall so this is not that helpful. See https://www.whoishostingthis.com/resources/ansi-sql-standards/#sql-ansi-standards-for-database-administration for an explanation of ANSI SQL standards.
Different db2 products (Z/OS, LUW) might have different extensions. Z/OS has to do horrible mainframey stuff that LUW can do without. But you wouldn’t be given a choice, you have to use the commands implemented by the database that you are connected to. The SQL client doesn’t have a role in this.
We are developing software that generates and executes SQL queries for Oracle and SQL Server using ODBC drivers. We are researching the possibility to expand to DB2, but I read that there are several versions available. DB2 for LUW, for iSeries and for z/OS.
Are there any differences in SQL of SQL/PLSQL functionality in these versions?
As a ISV, is it possible to get a development environment for DB2 for iSeries or z/OS
As many other answers already say, there are differences between the members of the DB2 family. All DB2 are SQL-99 complaint, and each member has specific features of the following SQL standards (2003, 2006, 2008, 2011). Also, some extra features have been added to each member, for example autonomous transaction or modules in LUW.
There is a group in IBM called SQL Language Council (SLC) and its purpose is to discuss about the DB2 family compatibility. The following articles written by the SQL architects (Serge Rielau and Rick Swagerman) talk about that:
More family matters: Selected common SQL features for developers of portable DB2 applications
Family matters: The SQL Reference for Cross-Platform Development
This group creates a document called SQL Reference for Cross-Platform Development that describe the compatibility between members of the family. The current version is 4.0, and it groups the features of the current DB2 versions.
Also, a recent series of articles in DeveloperWorks talk about the features in each member of the family. That gives you the portability between DB2:
Selected common SQL features for developers of portable DB2 applications
Selected common SQL features for developers of portable DB2 applications (Previous v4)
More info:
DB2 UDB Family On Common Ground
Information on this can be found here:
http://www-01.ibm.com/software/data/db2/linux-unix-windows/index.html
And here
http://troels.arvin.dk/db/rdbms/
However all mentions DB2 versions conform to SQL-92 so the SQL standards are the same across the board
I want to know is there any software design the schema of oracle database?I mean if you work with Microsoft Sql U can easily design your database ,see the relation ,all tables and their fields,I want to know is there any software do same work in oracle.
I already try to find it in oracle Developer but nothing found!
Take a look at Oracle SQLDeveloper, I think it provides such functionality.
Not free, but PowerDesigner, Embarcadero, ERWin... can be used for that.
Toad also does this Toad for Oracle - Freeware
I need a test database to practice joins and other kinds of data retrieval operations in SQL.
What's a good free test database and RDBMS system to use on Windows?
Every major RDBMS provider has some free edition. Those are full versions limited by database size and maximum memory usage.
Top players:
Sql Server Express
Oracle Express
IBM DB2 Express-C
Then, there is number of open source products:
PostgreSQL
Firebird
MySQL
SQLite (not really a RDBMS, but understands SQL and it can be used for your purposes. Also, very small and compact)
If this is not enough, check this Wikipedia article: Comparison of relational database management systems.
There's more than 50 RDBMS's listed and you'll probably find something that suits your needs.
SQL Server Express for one.
Sample databases (AdventureWorks) can be downloaded here.
You can use this link. The adventure works database is used as an example for numerous online and offline resources.
After which, download the SMSS Express to work on it.
If it's just for practising SQL you could install Access assuming you have an MS Office CD that includes it already.
Otherwise MySQL or SQL Server Express are probably your best bets.
I would recommend MySQL over SQL Server Express if your purpose is to practice SQL. The command line interface is all you need.
You can get online practice with verifying your queries on SQL Exercises
select sys.database_name,sys.sysevent,sys.login_user from dual;
what is sys in this query?
Can I see the other functions that are in sys?
What is the query for doing so?
In what situations is this sys useful?
Where will be the information about sys is stored in database?
sys is the system schema. It holds various tables and views that support the rdbms.
You might check out the oracle wiki article which talks about the various schemas and their meaning.
http://en.wikipedia.org/wiki/Oracle_database
In many database systems, including the major database products from Oracle, Microsoft and Sybase, groups of related database tables can be pulled together into a schema.
Some large systems (and, for that matter, some not so large systems) use this as a way to control access, or just as a way to keep things well organised.
For example, the tables supporting an online catalog (e.g. Amazon or Barnes & Nobel) might all be Marketing.*, the tables around order fulfillment Sales.* and those around Stock management Stock.*.
The sys schema that you've noticed is where system tables live - tables that you can query to find out details about the rest of the database - such as whether a column already exists.
I agree with Bevan. Here are some answers specific to your questions:
(I'll make the assumption you're talking about Oracle)
Can I see the other functions that are
in sys?
Yes, like any schema you can view the procedures, functions and packages in sys using a database development tool such as Toad, PLSQL Developer or Oracle SQL Developer. However my experience has shown that referring to Oracle documentation (freely available online) is a better way to learn about the available functionality than jumping straight to the source code.
What is the query for doing so?
I'd recommend the use of one of the development tools above. Failing that, try:
select * from user_objects where type in ('PACKAGE', 'PROCEDURE', 'FUNCTION');
Once you've found the functionality you're looking for use the DESCRIBE command in SQLPlus to determine the method signatures and data types.
In what situations is this sys useful?
SYS is most often often used as a super user for adminstrative tasks as it has more privileges than a common schema. SYS also contains a lot of the infrastructure on which Oracle depends - don't mess around with the objects that SYS owns.
Where will be the information about sys is stored in database?
Use the methods I have suggested above - but I recommend you read the online documentation rather than dive straight into the source.