|
HobbyProggy wrote: A lot of my DB query execution code uses transactions
Maybe I have a big gaping hole in my understanding of DB's, but why do you need to create a transaction if you're "just" doing a query? Are you writing to some temp tables to perform the query?
Marc
|
|
|
|
|
Not really, but let's say i would insert 20 datasets that are dependant of something else and dataset 19 fails i need to reroll the whole data. That's actually why i use a transaction, so it get's done en block and can be reverted in case of failure.
Rules for the FOSW ![ ^]
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
Again, why would you put any SELECT in a transaction? (Hint, hint)
|
|
|
|
|
THANKS! I now reread it and got it. Maybe that was the knot in my head!
Rules for the FOSW ![ ^]
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
Hi,
In my table having, from time and to time, I have to calculate the difference between the two times to calculate hour's of time worked. So can anyone provide me a solution
|
|
|
|
|
Do some research into DATEDIFF[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yes, I checked using datediff and my query is
select datediff(hh,'05:30:00','10:00:00') from tablename
but it gives me 5 as answer which is not correct
|
|
|
|
|
It is perfectly correct, you looked for the difference in hours. Use your brain, try minutes or even seconds, if you wait for answers to be spoon fed to you it is going to be a long slow day.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks.. I got the answer
|
|
|
|
|
Hi,
I have mySQL with first_name, middle_name and last_name fields.
How can I pass a string from my php like param_name so when the user pass single name or multiple name it will split and search for the name in every fields..
For example if the user search for param_name = ""John Mathew Clark" it will do:
first_name or middle_name or last_name LIKE "%John%"
first_name or middle_name or last_name LIKE "%Mathew%"
first_name or middle_name or last_name LIKE "%Clark%"
Thanks,
Jassim
Technology News @ www.JassimRahma.com
modified 14-Jul-17 15:56pm.
|
|
|
|
|
I don't know about MySQL but in SQL Server I have done the following in the past.
Build a function that takes a string and splits it on a delimiter (space) and return a table.
In your query left outer join the function, passing in your name field, on your name field with Name = or LIKE '%' + itemFromFunction + '%'
Make the result set DISTINCT.
Not sure if = or like is needed in the LOJ.
This is an old SQL Server split function I dug up.
<pre>
ALTER FUNCTION [dbo].[fn_Split]
(@List varchar(8000), @Delimiter char(1))
RETURNS @Results table
(Item varchar(8000),ID int Identity(1,1))
AS
begin
declare @IndexStart int
declare @IndexEnd int
declare @Length int
declare @Word varchar(8000)
set @IndexStart = 1
set @IndexEnd = 0
set @Length = len(@List)
If @Delimiter = '' Set @Delimiter = ','
Set @List = Replace(@List,char(9),'')
Set @List = Replace(@List,char(10),'')
Set @List = Replace(@List,char(13),'')
while @IndexStart <= @Length
begin
set @IndexEnd = charindex(@Delimiter, @List, @IndexStart)
If @Delimiter = char(32)
set @IndexEnd = charindex(Space(1), @List, @IndexStart)
if @IndexEnd = 0
set @IndexEnd = @Length + 1
set @Word = substring(@List, @IndexStart, @IndexEnd - @IndexStart)
set @IndexStart = @IndexEnd + 1
INSERT INTO @Results(Item)
SELECT @Word
end
return
end
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am having serious difficulties in my attempt to duplicate a production db to a test instance on the same server.
Using these examples has not helped:
Duplicate a database
Duplicate
Duplicating a database
Duplicating a database using RMAN
and there's more. All attempts with all these materials still end in failure.
Additionally, the lack of in-depth examples for Oracle administration available on the internet (indexed by Google/Bing) is concerning.
Okay, here's the closest that I have been able to get
1. Create test database with the Database Configuration Assistant
2. Create minimal SPFile {DB_Name=XXXX}
3. Shutdown test database
4. Start test database with NOMOUNT and minimal SPFile
5. With RMAN, connect to prod db (target)
- connect to test db (auxiliary)
- ran this command
RMAN> duplicate target database to XXXX
2> from active database
3> password file
4> DB_FILE_NAME_CONVERT '/oracle/oradata/prod/','/oracle/oradata/test/';
6. It ran for a minute then died with a lot of these errors
RMAN-05001: auxiliary file name D:\ORACLE\ORADATA\DCDI\CATALOGTBS.DBF conflicts with a file used by the target database
I have found some info with a 'you need to add this: CONFIGURE AUXNAME ....' but I have no clue where to add these lines and no example was provided.
By this point, the SPFile and Control file are in an invalid state. No clue how to get them back to try again. I've dropped and recreated the test database several times.
I have no clue what I am doing and I cannot find any example on how to do this properly. I've been working on this for about a day and a half and getting nowhere fast.
Can somebody help walk me through this or point me to a good example. I have no experience with Oracle admin and I'm reaching the end of my wits here.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
Can you not just do a backup and restore?
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
This is Oracle.
However much I prefer Oracle to SQL Server this is an area where Oracle sucks.
|
|
|
|
|
Would that copy everything? I need to copy not just tables and data, but procedures, users/passwords, links to other databases, etc...
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
I would use Export/Import[^] instead.
The Enterprise Manager has a graphical UI that's quite helpful.
If you export only tablespaces from the database you'll need to setup the users on the new database BEFORE importing.
|
|
|
|
|
While the export/import track is an option, it is necessary to get a complete copy of the database (users, tables, procedures, everything). Using RMAN's replicate feature appears to be the logical choice to accomplish this in one easy to reproduce procedure that can be run whenever it's needed. The trouble is getting it to run correctly the first time. Once I have the correct procedure to replicate this production database to the test database, I can write up documentation. I'm having difficulty in getting it right.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
No, you can choose whether you want to export schemas, tablespaces, tables or the whole database.
Data Pump Export[^]
|
|
|
|
|
I/O is frozen on database msdb. No user action is required. However, if I/O is not resumed promptly, you could cancel the backup. We are not using any third party tool to take backup.
Thanks,
SREE
|
|
|
|
|
|
Hi ,
I am getting this message on SQL log but i am not initiated any SQL job maintenance.
Please help me what this msg indicates.We are taking Drive backup.
Msg:
Database backed up. Database: abc, creation date(time): 2015/04/17(08:07:47), pages dumped:56589001, number of dump devices: 1, device information: (FILE=1, TYPE=VIRTUAL_DEVICE: {'{622759E005}7'}). This is an informational message only. No user action is required.
Thanks,
Sree
Thanks,
Sree.
|
|
|
|
|
|
I have to do an upgrade of MSSQL database like this :
I have folders that each contain an sql script
I must have a sql or batch script that allows me to upgrade my database by running scripts that exist in these folders depending on the version of the current database:
Example:
folders
1 Folder has the name: v2.00
2 Folder has the name: v3.00
3 Folder has the name: v4.00
the initial version of the database: v3.00
the version of the final database: v4.00
So I have to have a script (or batch) that allows me to:
execute just the proper scripts (in this case v3.00 and v4.00)
|
|
|
|
|
How do you determine the "version" of the database?
|
|
|
|
|
there is a table which contains this information
Table "TVersion" and field "FVersion"
|
|
|
|