Sybase query to retrieve dba activity - sybase-ase

I am new to Sybase ASE, I needed help in crafting a query which will retrieve from the Sybase database the database administrator activity (specific db users). DBA has informed that the auditing has been enabled on the Sybase database.
The logging solution requires a Sybase query to read from Sybase.
Kinda like reading the DBA_COMMON_AUDIT_TRAIL in Oracle.
Thanks.

audit_db is typically the database name, and audit_data is the table that stores the trail.
I would suggest that you read the Auditing section of the Security Administration Guide for Sybase ASE.
It includes a section on querying the data, as well as what all the flags and values are.

To write a query, You need to understand what are the options enabled on the sybase instance to be audited. When we enable the auditing, it basically records just the login attempts of any user. To get more information from the audit tables, You should have other audit option enabled. It can easily be checked from sp_displayaudit. The data that you require are saved in tables named as sysaudits_01, sysaudits_02 in database sybsecurity database. If different audit options are enabled, You can easily query these tables using pl/sql.
Please let me know if this helps!!

Related

MS-Access Add Additional Linked Tables

I have an MS-Access database that was converted to use SQL Tables using the "Microsoft SQL Server Migration Assistant 2008 for Access" (aka SSMA) and created linked tables (so the MS-Access interface still works but is linked to SQL Tables).
Modifying those tables has been no problem (modify in SQL, use the Linked Table Manager in MS-Access, update tables). But I've not added a new table in SQL and I can't find a way to add that table to the set of linked tables.
I've tried the External Data -> ODBC Database, but it wants me to make a FileDSN and since the SSMA tool didn't require that I don't want to have some tables linked one way and other files liked another way (does anyone know how SSMA links the tables?).
So my underlying question is: Without using DSN how do I add an additional SQL Server table to MS-Access as a linked table?
I always create a DSN for development in order to make creating linked tables easy. Then after linking, I run Doug Steele's code to convert them to DSN-less connect strings:
http://www.accessmvp.com/djsteele/DSNLessLinks.html
Theoretically, his code would tell you enough to figure out how to link DSN-less without using the DSN as a starting point, but I've never found it worth the effort, since it's so easy to create the development DSN and run the conversion once the links are created.
This is a pretty popular question on SQLServerPedia, and read through the answers here:
http://sqlserverpedia.com/blog/uncategorized/how-can-i-link-a-sql-server-database-to-ms-access-using-link-tables-in-ms-access/

OpenEdge SQL DBA Account Setup

I'm setting up SQL access in a newly created OpenEdge 11.5 database.
In checking the contents of the sysdbauth table using "select * from sysprogress.sysdbauth", I see that there are two users setup by default: sysprogress and a user with the name of the Linux user account that was used to create the database.
I'm looking for recommendations as to how to handle these two accounts. Obviously I want to have an account to use for DBA tasks. Should I use one of these accounts for the purpose? If so, what should I do with the other account?
Is it possible (and safe) to be deleting either of these predefined accounts?
On page 175 of the Database Administration guide you can read about default users and why they are created:
Tables used from SQL only
An SQL database administrator (DBA) is a person assigned a sysdbauth record in the database.
SQL DBAs have access to all meta data and data in the database. To support internal schema
caching, every OpenEdge database begins with a DBA defined as "sysprogress." However,
OpenEdge restricts the use of "sysprogress."
When you create an OpenEdge database using the PROCOPY or PRODB commands, and the
database does not have any _User records defined (from the source database, for example), then
a DBA is automatically designated with the login ID of the person who creates the database. This
person can log into the database and use the GRANT statement to designate additional SQL DBAs,
and use the CREATE USER and DROP USER statements to add and delete user IDs.When creating
users, this DBA can also specify users as SQL-only users, who can only access the database
through SQL.
There are several knowledge base entries around the task of deleting or disabling the default users.
http://knowledgebase.progress.com/articles/Article/P5094
http://knowledgebase.progress.com/articles/Article/P161411
This suggests that it's really safe to delete or disable these accounts but you should:
1) Create replacing accounts first.
2) As always: test in a separate environment first and not in production!
Yes, in fact Progress kind of expects you to do so. Create a root account and get rid of both. It's fine.

Querying with data from multiple databases

i have MySQL database db1 with data of user and it managers, and db2 with oter data related to user, but without user manager column.
I need to query db2 and group data by user manager.
if they were on same server that would be easy.
do you have any suggestion how to do this, even on non query fashion?
NOTE: db1 and db2 are not on same server, and query will not contain just simple sums
You can try to use federated tables in MySQL, and it will let you access data from a remote MySQL database
You can check out this on given links below
http://dev.mysql.com/doc/refman/5.1/en/federated-storage-engine.html
http://dev.mysql.com/doc/refman/5.1/en/federated-create-server.html
http://dev.mysql.com/doc/refman/5.0/en/federated-limitations.html
I guess it may work for you.
Happy Coding!
Atul Jindal

How to add additional information to Axapta Database without administrative privileges?

I am writing for advice on whether solution you recommend to choose.
Here is in a nutshell what I have:
Axapta databse on MS SQL Server 2008 R2.
Several SQL queries using the data of the database through PHP web application.
Webserver, which is running web application.
No administrator privileges on the Axapta databse (only SELECT permission).
Rights to write and modify on the webserver with MySQL database.
Light computer with Windows OS permanently working on the network. On this light computer I have admin rights.
Here's what I want to achieve :
Creating replication (exact copy) of few (10) tables on the webserver as another database, which will sync up as often as possible with Axapta database .
Adding some dictionary tables and views for the new database (to be able to insert the dictionary to earlier SQL queries) .
For now, I came up with this solutions:
I tried to add 'replace' and 'case when' to SQL queries on the Axapta database, without any other additional databases. However, with these new large dictionaries, query performance was poor and waiting for the results drived me crazy ;)
The only thing I could do is a manual export via ODBC to a MySQL webserver database. Is there a free program to automate this process? I mean eg. hourly update data from Axapta MSSQL database to webserver MySQL database (with help of this light computer which I mentioned before)?
Please let me know if you see any other possibilities to expand utlility of webapplication which uses Axapta database.
I don't know if there are some SQL sync agent from MSSQLServer to MySQL.
If you are writing your own tool, you can try to get your diff by yourself:
delete MySQL records where the RecId is not available in MSSQLServer anymore
insert new records for MSSQLServer records with unknown RecId
update records when ModifiedDateTime is greater than your last sync
At last I found a powerful solution, and reccomend it to everyone who has similar issue. PDI -Pentaho Data Integration (Community Edition) is a perfect way to do the dictionary transformations I mentioned above. It could even read from .xls or .txt files. You could get it from the link below, and don't forget to be active developer community member.
http://community.pentaho.com/projects/data-integration/

Create/Update/Delete through my Code or Manual Operation in Database?

How would I know when create, update and delete operations on my Database is through my written code ?? or manual operation in DB ??
sometime developer needs access to production server :(
In order to track history, you need to enable the "SQL history feature" of phpMyAdmin. You can find details on how to do this on the documentation site.
One thing to note is that the SQL history feature will only track commands entered via the phpMyAdmin interface. If you're looking for specific transaction history on a given table that an application does, you will need to implement some kind of tracking or log feature into the application(s) involved.
Depending on how things are setup, you may be able to access the binary log of the MySQL database itself through phpMyAdmin. You'll need to look into your current database configuration to see where/how to access it.
make sure developer is using a unique user so you can identify him
log mysql queries to table mysql.general_log
SET GLOBAL log_output = 'TABLE'
SET GLOBAL general_log = 'ON'
then you can check mysql.general_log and watch for connect commands from that user (the queires he run would be right after the connect command)
hope this helps

Resources