Trace MS Access DB activity - debugging

I have an Access application with a SQL server back-end, mixed with quite a few DB objects local to the Access app. I've tried running SQL Profiler, but I got very little except a cryptic sp_execute 2,4288,4289,4290,4291,4292,4293,4294,4295,4296,4297.
I would like a trace tool that is local to the Access DB, so I also pick up any activity that doesn't go back to the SQL server.

As far as I know there is no such facility within Access but, depending on your case, you could try these few things:
Write a wrapper against SQL executables: that would mean replacing all calls to Execute, OpenRecordset etc within your VBA to an alternative version that would log the query.
This isn't going to catch everything obviously but it could help.
Move your local tables to another database and use ODBC to relink them to your original Access application. You can then use ODBC's logging facilities.
This could be the best altenative as it's fairly easy to setup for debugging.
It's not the best solution for a production environment though as all your calls to local tables will in fact go through ODBC, but again, it's a temporary solution for debugging.
Use ShowPlan and ISAMStats to view how Jet/ACE interprets your queries and get other database activity stats.
It's easy to setup by writing a key to the registry and you'll end-up with a log describing how your queries are analysed.
It's more useful for optimisation than logging but again, it could help.

Use Flextracer, a shareware, free for 30 days or so. My colleague here has just found this for us as we were going through a similar situation. Problem solved.
http://www.geardownload.com/development/flextracer-download.html
[]s,
Pedro Carneiro Jr.
pedrokarneiro#hotmail.com

Related

Oracle Application Express - Backups

I have been tasked with creating some backups for some Oracle Apex apps (Application Express v4.1.1.00.23). The request is to back up both the applications & referenced db objects (not sure if this means just structure or structure & data).
On the one hand, I would have expected standard db backups to handle most or all of this but I'm very new to Apex so it's all a learning curve.
I'm currently exporting the application from apex and then exporting (using SQL Developer) all the database object dependencies that Apex gives me - although I see that the list doesn't include functions that are used for auth.
This seems a really clunky process that's very prone to mistakes (miss an object, save something to the wrong place, no guarantees of consistency etc).
Does Apex (my version!) offer something to do the job or is there something else I could be doing? I've had a good google but nothing has stood out.
UPDATE: I realise now that I should have included some extra info. I'm currently at a large organisation & I believe our db backups (which I guess/hope are done using rman) are done by a different department. I think the motivation for the request is so that we have some local, easily accessible backup so that if one of the developers messes something up we don't have to go through multiple layers of organisation (& undoubtedly a lot of time) to sort ourselves out. I suspect that some kind of source control would be a great starting point but I'm not sure how far I'll get with that idea - especially as we seem to have little in the way of autonomy over things like servers.
RMAN is the way to go to backup an oracle database:
https://docs.oracle.com/database/121/BRADV/toc.htm
there are tons of material on the hows and whys online; just google "oracle rman" and you'll find what you need (the documentation should cover you as well of course).
cheers
Standard DB backups will include everything you need.
The Apex applications I develop are static, meaning the end users make no changes to the Apex application, and there is no need to make a specific backup other than to store the original apex application .sql installation files in a safe place.
If you must, you can make an export of the database schemas the application uses. For example with the expdp utility.
IN apex you need to take 2 backups one in the workspace
Second your application
Third is while using export import from the database it tends to loose & character in procedure ..So beter use rman and take a complete backup.
I have found this Oracle white paper Life Cycle Management with Oracle Application Express (Revision 2) which does what it says on the tin - including various strategies for exporting, backing up & managing 'lost application development'. It's a really good read and I'll be using it as a template for suggestions of how we can manage our process in future.

Linq DataContext.CreateDatabase on Azure

This came up once before: Use DataContext.CreateDatabase in SQL Azure
The answer accepted was "maybe it's not possible". Didn't seem like a full answer.
I have a set of classes fully defined and I am wanting to create a database on Azure for this. It's not working because the USE statement does not work: http://msdn.microsoft.com/en-us/library/azure/ee336288.aspx
So, the database gets created as blank, and internally Linq generates a USE statement to move to that database and start adding tables. This fails and it throws an exception.
So how can I create my database? Can I use Linq to add tables to an existing database? Can I enable USE on Azure somehow? Seems ridiculous this does not work.
After messing around for a while on this, I ended up creating the database against a local SQL Server instance. Then used SQL Server Management Studio -> Tasks -> Script Database, and turned on the export type to be Microsoft Azure. Then I had the script file needed to run on the Azure server. I'll leave the question open for a day or two because I am curious if this can work with Azure directly somehow. If I don't hear anything, I will close it.
The USE statement does not switch between databases in Azure SQL Database. You will have to connect to the database to create a table on that database.
Regards
Dhruv

Storing DDL scripts into a clob

Using Toad for Oracle 10.6 with DB Admin Add-in. For our migration process Dev to QA to Prod, we are starting to use the Schema Compare Module to generate the Sync Script DDL. After execution, we want to store the Sync Scripts for historical purposes. Due to policy, we are unable to copy these much of anyplace. Even the Windows server where toad runs is write-restricted.
I am thinking I could create a table with a CLOB column and store the scripts there, unless you folks tell me that this is a Really Bad Idea. I am looking for any tips on things like handling embedded special characters, or any other pitfalls that I may encounter.
Thanks,
JimR
Doing the best with what you have is a good thing. If management won't let you have version control, then jamming it in the database is better than nothing at all. The important thing is to create a process, document it, and follow it for deployments.
As for using schema differences to deploy, take a look at:
http://thedailywtf.com/Articles/Database-Changes-Done-Right.aspx

How do I browse databases on an Oracle Server?

So I'm coming from a position as a SQL Server developer who has written a little bit of PL/SQL way back in the mists of time but effectively knows nothing.
I've got a laptop, it's running Oracle. There is a database on the laptop which I need to have a look at and neither I, nor anyone else I can speak to, knows what it's called.
I have a couple of logins including one which alleges to be an Admin login.
What's the easiest way to browse the databases on the server and then connect to one?
I suspect that my assumptions about relationships between servers, users and databases from SQL Server are leading me astray but right now I can't get past idea that the client tools Oracle ships are someone's idea of a joke but I'm really not finding it that funny.
I'm pretty sure that it's version 9.2 that's running.
Happy to provide more information but right now I don't know where to start.
If this is windows look in the services. Each database will have a separate service. By default these are named OracleServiceDATABASENAME.
You may be able to connect with just this information on the default port 1521.
If that does not work open the properties of that service you can find the location of the oracle home. The default place to keep your connection information in the ORACLEHOME\network\admin\tnsnames.ora . Using the database name you can find your connect information in this file.
If this is linux/unix look in the /etc/oratab file. This should have the database name and oracle home listed. The default location of the tnsnames.ora file is the same as on windows.
Once you have this information you can use any of the tools mentioned above to connect to the database.
I don't know what qualifies as "easiest" in your book. I'm moderately fond of Aqua Data Studio (www.aquafold.com); it's nice & visual & pretty & all. It's also Not Cheap, but might be worth a 2-week evaluation to see if it does anything helpful for you. I'm not an expert on this, and I joined an Oracle-based group from a SQL Server background; that's the tool they were using at the time, and I've found it extremely usable. But that's just me. Good luck.
Check out Oracle SQL Developer. (It's free)
I'm not a SQL Server expert, but there are differences in terminology.
An Oracle "Instance" is a single entity of the Oracle software. A database is the actual logical data that the instance serves. You may have multiple instances of the Oracle database software running against one database (This is considered a RAC setup); or just one instance running against one database.
I'm assuming what you mean by database here is actually the different schemas/users/tablespaces/procedures etc. that you have within an Oracle database. In that case, Oracle SQL Developer should do the job nicely.
If you are able to utilize Enterprise Manager (this is a licensed option), it provides this functionality as well, though it is more cumbersome than SQL Developer IMHO. EM does provide many other tools for providing a general overview of your Oracle instance health, alerts, and many things used to help tune the performance of your Oracle instance.
In Windows, the following command lists running database services:
net start | findstr -i ora
In Unix/Linux, grepping for the Oracle SMON process will give you the names of running databases:
ps -ef | grep smon

How to troubleshoot Oracle database server errors?

My team inherited an Oracle-based web application and they are fairly inexperienced with Oracle database servers.
The Oracle 10g server is running on a Windows 2003 Server with plenty of disk space and from time to time, all connectivity is lost, the application stops working, not even SQL Plus is able to connect to the database server.
But when we check the Windows Service manager, it says that the service is up and running. A restart usually fixes the problem, but we need to properly troubleshoot it so we know what's causing it and so we can avoid it to happen anymore.
Where should we start looking for clues? What are the criticial log files we should be investigating?
On the server you should have an environment variable called ORACLE_HOME which indicate the root of the Oracle install. Most likely the Oracle trace/dump folders will be under there. Search for a folder called "bdump" (background dump). That's where the main log file, knows as the alert log, will be, as well as trace files generated by background processes. There will be an adjacent file called "udump" which will contain any trace files generated by user processes.
However, my real advice is that you should either hire someone who knows Oracle or get Oracle Support involved.
The alert log would be the first file to check.
It will probably be in $ORACLE_HOME/admin/bdump and (probably) called alert_DATABASE-SID.log
It contains most of the important actions that the database does, as well as any important errors that occur.
I have to agree with cagcowboy. Check your alert logs for errors. If no errors then maintain a sysdba login into the database and when it hangs, attempt to do a hang analysis. See metalink note 215858.1 on hanganalyze.
Have you tried tnsping? We've occasionally run into problems with the listener that requires an assist from our DBA. tnsping is the diagnostic tool we use to do triage.
I would recommend hiring an experienced Oracle DBA if at all possible.
check the alert log to see how the Db is structured. sometimes badly set parameters make hangs or slow performance. or you can shutdown and start in mount mode, then check the v$parameter values for problems. setting total memory is very important.

Resources