How do I create a query use log in VB.NET? [duplicate] - vb.net

I'm using Oracle 11g Standard Edition.
I would like to log all SQL queries, that are being executed by users, into a table.
How can this be done?

If you're using a modern version of the database (9i or later) and you have an Enterprise Edition license you can use Fine-Graining Auditing. It allows us to audit user queries at a very low level of granularity, through defined policies.
To capture SQL text and bind variables you will need to set the AUDIT_TRAIL parameter appropriately when adding an FGA Policy. Find out more.
"i'm using an 11g standard, so auditing functions are not supported."
Not exactly. The AUDIT command is part of the standard Oracle build, but it only allows us to capture when a given user issues a SELECT against a given table. But, yes, to find out exactly what they are selecting requires Enterprise Edition license.
Also there is no ON SELECT trigger, so we cannot roll our own.
"So can i use AUDIT command in the standard edition? ... But then a
consultant told me, that i cannot use it without paying enterprise
license? "
Speaking as a consultant myself, I do have to say those guys don't always know what they are talking about.
So let's be clear:
the AUDIT command is part of Oracle SQL. It is usable with the Standard Edition. In fact since 11g it is enabled by default. It audits general activity. Find out more.
Fine Grained Auditing is a PL/SQL package with is only usable if you have the Enterprise Edition. It allows us to audit user activity at a very low level. Find out more.

For QUICK, EASY logging of SQL, try my monitoring answer here. Not for long-term logging, but works great just to see what is going on in a small time window. :-)

Related

DBACOCKPIT tcode on two SAP systems look different, why?

I have 2 different systems with SAP installed on them. First installation running on SQLServer, and the other installation running on Oracle.
In the first installation of SAP running on SqlServer, when i run DBACOCKPIT tcode, i get the following subfolders;
Performance, Space, Backup And Recovery, Configuration, Jobs, Alerts, Diagnostics, Download.
However, on the second installation of SAP running on Oracle. I get the following sub folders only: Performance, Space, Jobs, Diagnostics.
Why don't i get the other folders?
Both systems run ECC 6.0
SAP Basis components of both are a bit different:
Despite the difference of DBACOCKPIT layouts between MS SQL system (A) and Oracle system (B), I think it is normal. Possible reasons for this are:
lack of necessary user authorizations on system B
different set of authorizations of user A and user B
Oracle database was configured incorrectly or was not configured at all
SAP Note 1028624 regarding Oracle DBACOCKPIT says
Some performance monitors within the DBA Cockpit require special database objects. These objects are created using an SQL script. See Note 706927 for this script and more information.
Some functions in the DBA Cockpit require the Oracle Active Workload Repository. This Oracle option must therefore be available for selection (see Note 1028068).
This note also exactly specifies set of functions available in DBACOCKPIT for Oracle, and this set fully corresponds to your screenshot.
The DBA Cockpit has a navigation area that is visible in all the functions of the DBA Cockpit. This area contains a menu tree with the following access points:
- Performance (corresponds to the old transaction ST04)
- Space (corresponds to the old transaction DB02)
- Jobs (corresponds to the old transactions DB13, DB12, DB14, DB13C)
- Diagnostics
At the same time MS SQL DBACOCKPIT also corresponds to SAP standard, which is confirmed by SAP Note 1027512 and by this datasheet, for example.
Possible steps for research:
check if authorizations S_RZL_ADMIN and S_BTCH_ALL are assigned to you, as it stated in detailed DBACOCKPIT description from note 1028624.
check SAP Database Oracle Guide for compliance with you system B setup
This is absolutely standard situation.
I am also have a two systems with the same version of ECC.
One on MS SQL Server 2014
Another one on SAP HANA SPS03
and
DBACOCKPIT t-code looks different in these two systems.
All OK!

Is there a way to "bind" to an Oracle SQL database and get noticed of every update operation in it?

I was wondering... Is there a way to "bind" to an Oracle SQL database and get noticed of every create / update / delete operations in it, by any user?
A bit far-reaching demand, I know... My goal is to investigate how a specific application uses the DB. A good tool for comparing the data (not the schema) between two states of the database would also be a fair solution. A solution without having to dump the DB into a file every time is preferred.
Thanks in advance!
I would go with
Flashback Data Archive (Oracle Total Recall) available in Enterprise edition, and
Auditing available in any Oracle edition.
The two can be combined to suit your needs.
#a_horse_with_no_name suggested you using Log Miner, and it is a nice solution. But if you are a novice DBA, you can check Oracle Flashback Transaction Query which has a friendlier interface (though it still uses Log Miner underneath to analyze archived redo log files retrieving transaction details).
Some useful info WRT on using built in Oracle Auditing follows.
How to get index last modified time in Oracle?
Enabling and using Oracle Standard Auditing
Find who and when changed a specific value in the database – using Oracle Fine-Grained Auditing, plus some info regarding Log Miner.

check permissions in a database

we are using SQL2012 Enterprise Edition and have a small problem with one of our DBA (5 persons with more than 100 instances). is it possible to check who has changed given, denied or revoked permissions and when this was done? I could not find any trigger or audits.
Thanks for your help and best regards from HAMBURG in GERMANY
Two choices spring to mind here:
Use SQL Server Audit, and create audit specifications to capture the events that you are interested in (see http://technet.microsoft.com/en-us/library/cc280386.aspx for more details)
Use server level triggers to capture all DDL events (see http://www.mssqltips.com/sqlservertip/2085/sql-server-ddl-triggers-to-track-all-database-changes/ for an example of how to do this)
We basically use the second approach across our production instances for audit purposes, and to record a complete history of all schema changes across all databases so that we can accurately identify what has changed (and by whom, and when) to assist with production troubleshooting of issues.

integrate data between oracle and sql server

I have an oracle database that is very large in size.
I also have a sql server database. I want to integrate data from the oracle database to the sql server database and also the opposite way. This does not need to be real time but can work in the background possibly on defined intervals during the day.
What is the process for setting this up and how may it be achieved?
You should look into Microsoft SSIS:
http://en.wikipedia.org/wiki/SQL_Server_Integration_Services
One possibility is to use Oracle Golden Gate software. It does cost money but it supports real time data movement between many different database architectures, including the ones you specifically care about.
Creating DB links is the best option for this. With DB links the databases can talk to each other directly. No need for additional software or programming, this is standard functionality in Oracle and SQL Server and is very reliable.

Can i monitor performance of particular table in sql server 2008 profiler

I want to monitor all the DML commands that run on a particular table of my database in sql server profiler. Im using sql server 2008 R2
Besides the suggested solutions, you can use a third party tool that reads SQL Server traces.
ApexSQL Comply is a SQL Server auditing tool that used SQL traces, reads relevant information from them, and stores it into its central repository database. It allows you to select the tables and event types you want to monitor. You can specify to monitor different set of events for every database.
It provides various built-in reports, where you can filter by a specific DML operation. It also has custom reports, so you can create your own reports.
You can set the tool to monitor just specific events on the table, or if you monitor all events, you can use the filters on the reports to show just the DML commands.
Disclaimer: I work for ApexSQL as a Support engineer
Yes sure - you might want to check out this video series by Brad McGehee:
Mastering SQL Server Profiler - Video Training Course
It's very useful and teaches you the basics and some more advanced concepts of SQL Server Profiler. Highly recommended.
Or here's the 10-minute short version by Brent Ozar: SQL Server Profiler Tutorial Video
In SQL Server Profiler, when you create a new profile trace, you can define filters. You can limit the stats being collected by a ton of different criteria - one of them being the Object Name , e.g. the table name you want to check for.
See Profiler Filters for more information on that particular topic.
Depending upon your exact needs you might also want to look into extended events. This has several advantages over using SQL Profiler/ SQL Trace in terms of performance, flexibility of filters, and the information available.
If you do decide to investigate this further you might find my answer to another question useful for getting up and running.