Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all 13329 articles
Browse latest View live

dump tran not working due to error logical page

$
0
0
Hi Guys,
I'm having problem dumping the transaction log due to logical page error. I've already done fixing table level relating to error on fetch logical page but the problem still persist. I suspect i have already corrupt pages on transaction log prior to fixing the table. btw, querying what object belong on the page gives me an output of NULL. below ff procedures already done but no luck in clearing the error page.


1. dbcc checktable(syslogs) - gives me an output of

The default report option of OPTIMIZED is used for this run.
The default fix option of NOFIX is used for this run.
************************************************** *************
TABLE: syslogs OBJID = 8
INDID=0 FIRST=16195517 ROOT=19184047 SORT=0
TOTAL # of extents = 0
Table Corrupt: Object id wrong; tables: alloc page 16195328 extent id=16195512 l page#=16195517 objid in ext=0 (name = 0) objid in page=8 (name = syslogs) objid in sysindexes=8 (name = syslogs)

trying using this command single mode on dbName, run DBCC TABLEALLOC('dbo.syslogs', full, fix) - still error

2.dump tran with no_log, truncate_only - still error
3. I can proceed with full database dump but unable to dump the transaction log using number 2.


I'm looking on this option running dbcc rebuild_log found on this link
http://www.petersap.nl/SybaseWiki/in...rebuild_log%29


I can afford downtime for just 1 day only but i need the database back online after that 1 day period.

sybase version : 12.5.3


The SQL Server is terminating this process.
Server Message: Number 4216, Severity 21
Server 'DO', Line 1:
DUMP TRANSACTION failed in database dbName: unexpected end of log encountered on page 16204071 while scanning for page 19244976.


Your advice would be much appreciated. Thanks advance

Exporting into an excel spreadsheet - error unless the formatting or layout is ticked

$
0
0
Not really sure if this should be posted in the VBA forum or Access
I am trying to write code to run an Access query and put it in an excel spreadsheet.

I have used
Private Sub ExportExcel()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "AccessQuery", "C:\Users\KSmith\Documents\KSQuery01.xlsx", True
End Sub

This gives me an error " is not valid name etc. I have done lots of reading on this and cannot track an error using any of the suggestions.

So then I decided I would give away the code and just use the excel shortcut in (the Access toolbar) External ---> Export ---->Excel I get the same error. (However it lets me cut and paste into an excel spreadsheet and all is fine)

But then if I tick the "Export data with formatting and layout" this error disappears Question.jpg

My question - how can I translate this the formatting and layout criteria into the code to avoid that error?
Attached Images

looping through unique values, saving them into designed workbooks with sepcial names

$
0
0
Hello,
I’m a new to VBA and found a macro which does almost what I want but need to be modified. I’ d be very grateful if you could help.
Let’s say I have:
- a workbook called “Source.xlsm” with 30 unique values in col A and 50 other columns fulfilled. First row is filled with column names
ID Name1 Name2 Name…n
A00001 A1 A2 A…n
B00002 B1 B2 B…n
……

- a workbook called “Dest.xlsm”; formatted file to which I want to copy unique values + all of the columns from “Source.xlsm”


A00001
A1
A2
A…n

- where in cell “D3” should be value from “Source.xlsm” A2. A1,A2, An…. should be below cell “D3”

I need a macro which will:
- open a “Source.xlsm”
- open “Dest.xlsm”
- loop through all of unique values in col A of “Source.xlsm”
- copy each of unique value to the separate “Dest.xlsm” file where in cell “D3” should be value from “Source.xlsm” A2. A1,A2, A…n should be below cell “D3”
- save the separate files “Dest.xlsm” for each of the unique value from col. A naming for example “A00001_ddmmyyyy.xlsm” where dd-day, mm-month, yyyy-year
- close all files

Macro, which loops through unique values in col A and simply copies these values into separate workbooks instead of copying them into separate “Dest.xlsm” for each of the unique value from col. A



Sub Extract_All_Data_To_New_Workbook()

'this macro assumes that your first row of data is a header row.
'will copy all filtered rows from one worksheet, to another blank workbook
'each unique filtered value will be copied to it's own workbook

'Variables used by the macro
Dim wbDest As Workbook
Dim rngFilter As Range, rngUniques As Range
Dim cell As Range


' Set the filter range (from A1 to the last used cell in column A)
'(Note: you can change this to meet your requirements)
Set rngFilter = Range("A1", Range("A" & Rows.Count).End(xlUp))

Application.ScreenUpdating = False

With rngFilter

' Filter column A to show only one of each item (uniques) in column A
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True

' Set a variable to the Unique values
Set rngUniques = Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisi ble)

' Clear any filter

On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0


End With

' Filter, Copy, and Paste each unique to its own new workbook
For Each cell In rngUniques

' Create a new workbook for each unique value
Set wbDest = Workbooks.Add(xlWBATWorksheet)

'NOTE - this filter is on column A (field:=1), to change
'to a different column you need to change the field number
rngFilter.AutoFilter Field:=1, Criteria1:=cell.Value

' Copy and paste the filtered data to its new workbook
rngFilter.EntireRow.Copy
With wbDest.Sheets(1).Range("A1")
.PasteSpecial xlPasteColumnWidths 'Paste column widths
.PasteSpecial xlPasteValuesAndNumberFormats 'Paste values
End With
Application.CutCopyMode = True

' Name the destination sheet
wbDest.Sheets(1).Name = cell.Value

'Save the destination workbook and close
wbDest.SaveAs ThisWorkbook.path & Application.PathSeparator & _
cell.Value & " " & Format(Date, "mmm_dd_yyyy")
wbDest.Close False 'Close the new workbook

Next cell

rngFilter.Parent.AutoFilterMode = False
Application.ScreenUpdating = True


End Sub



regards,
s

help with shifting from spreadsheet to database

$
0
0
Hi all, first post here, hope you guys can offer some advice.

I’m looking for help with a design concept that I just can’t get my head around at the moment to control and document the components we use in building circuit board assemblies.
At present we use a spreadsheet that is updated and saved with a new revision ID in its file name each time a new component is (or multiple components) are added or a change made to existing component(s)
Currently this is around 1600 components, each with multiple approved manufacturers.

To create a snapshot of this information, I would plan to use something like;

tblComponents
[ID]
[Desc]
... other information specific to designed part - tolerance, size etc.

tblApprovedParts_Alternatives
' would list multiple manufacturers and their part numbers for each ID part
[ID]
[Manufacturer]
[ManufacturerPartNumber]

What I’m struggling to get my head around is how to create the third dimension provided by the spreadsheet file name – essentially, how to create an revision history.
The current approach for this data is that any change to any of the data results in a new revision of the document. So a new component added, an old part obsoleted, an error in a manufacturer or part number corrected will result in 'components rev 123.xls' being updated and saved as 'components rev124.xls'

I can add a revision field and every time a component is added / changed, the whole data gets copied with a new revision ID, which to me is a quick and dirty (and unsustainable) way to make it work
How should I structure the tables and then what would the format of a query be to retrieve a particular revision of the data.
Really having a mental blank.

Thanks in advance,
Richard.

Eg

Rev 1
ID.....Desc..........Manufacturer.....MPN
1......RES 10K.....Bournes............060310K
2......RES 11K......AVX.................060611K

Rev 2
ID.....Desc..........Manufacturer.....MPN
1......RES 10K.....Bournes............060310K
2......RES 11K......AVX.................060311K - MPN corrected

Rev 3
ID.....Desc..........Manufacturer.....MPN
1......RES 10K.....Bournes............060310K
2......RES 11K......AVX.................060611K
3......CAP 10n......AVX.................0603100n - this part added

Introduction

$
0
0
Hi,

This is my first post ,firts of all I want to introduce my self..
I am Sumeet Arora, the founder and CTO of Evon Technologies graduated as an Electronics and Communication Engineer from HCST . I have been in the IT industry from last one decade and continously focusing on latest web and mobile technologies with my team.

Set Passthru on linux

$
0
0
Hi,

I have created few procedures on db2luw windows. Now I m trying to impact all the procedures on LINUX. In one procedure I m having

EXECUTE IMMEDIATE 'SET PASSTHRU '|| p_database ;

This procedure is working fine on windows db2 & trying to compile the same on linux I m getting the below error.I m having the SYSADM privilege.
OS: Linux, Database: Db2 10.5

Error:
Create stored procedure returns SQLCODE: -789, SQLSTATE: 429BB.
ARE_TABLE: 82: The data type for parameter or SQL variable "'SET PASSTHRU '" is not supported in the routine, compound SQL statement, or parameter list of a cursor value constructor.. SQLCODE=-789, SQLSTATE=429BB, DRIVER=4.17.30
The data type for parameter or SQL variable "'SET PASSTHRU '" is not supported in the routine, compound SQL statement, or parameter list of a cursor value constructor.. SQLCODE=-789, SQLSTATE=429BB, DRIVER=4.17.30
ARE_TABLE - Deploy for debug failed.
ARE_TABLE - Roll back completed successfully.

can someone kindly let me know what is error on linux & do i need to include anything else to work PASSTHRU on linux.

Thanks

Problems with search form

$
0
0
So, I have put up a search form, based on a querry.

Code like this: Like "*" & [Skjemaer]![fSøk]![txtDatoSøk] & "*"

This works perfect, except when I know put this form into my Navigation form, then the msgbox appears, asks me tu put in parameters... Any suggestions?

db2realocatedb

$
0
0
Hi all

I have a DB2 V10.5 database on a SUSE LINUX 11.3
I created the database sample using ~/sqllib/bin/db2sampl

I wanted to move all containers and files in another location and therefore I run db2relocatedb with the following cfg-file:

DB_NAME=SAMPLE
DB2_PATH=/home/db2inst1,/home/db2inst1/DATABASE/sample/metalog
INSTANCE=dbinst1
NODENUM=0
STORAGE_PATH=/home/db2inst1,/home/db2inst1/DATABASE/sample/data


I first deactivated the database, made sure that no process was running, and copied the files to the target location. I didn't delete the old files.

The db2relocatedb command ran successfully and I could connect to the sample database.
But as I checked the paths in the view sysibmadm.dbpaths I saw the old paths. Then I restarted the instance (db2stop/db2start) , connected again to the database I checked the paths. The sysibmadm.dbpaths shows now the correct paths.

Furthermore: after having run successfully the db2relocatedb if I rename the old paths and then try to connect to the database (which all containers and files have been moved to the new paths) I get the error:
SQL1042C An unexpected system error occured. SQLSTATE=58004

Why does DB2 not recognize the new paths dynamically?

Thanks and regards
Renaud

Deployment software

$
0
0
I am looking for a software package to automate deployments of SQL scripts (procedures, tables, etc.), and SSIS packages for SQL Server. We don't need to compile JAVA code, or package .DLLs in a deployment. I just want to widen the pool of folks able to hit a button and deploy a pre-defined deployment. I am debating trying to write one myself, as it is just SVN, SQLCMD, and move commands, but if a package already exists (and is supported), that would be much easier. What do the rest of you folks use for these things?

make it dynamic - partition(dailyp20150514)

$
0
0
Hi,

I am running stats on a table which is partitioned. Current I use the below query:

select * from testing partition(dailyp20150514)

It is possible I can run the above query for the whole month dynamically. Maybe put sysdate somewhere as it would make it dynamic.

The "testing" table does has a time but running again the time column takes a lot of time so partition results are the fastest reults.

Also I don't want to include the weekends (Fri, Sat)

Could you please help.

Access Web App Popup Not Functional In Firefox?

$
0
0
Hi,

I have a client using the Firefox browser and when they click on a button that should open a popup form in an AWA, nothing happens. I've tested this myself on the most recent version of Firefox, and found that even if I disable popup blocking (uncheck it in the Options / Content area), I still cannot get the popup to work.

I have no problem opening the same popup in IE and Chrome.

Does anyone have a way of adjusting Firefox to allow for Access web app popups?

Thanks!

SSIS Package To Export Stored Procedure Results To CSV

$
0
0
I have used BCP to perform this, but I now need an SSIS package. Is this possible to use an SSIS package to automate the task?

index creation taking longer in production than QA box

$
0
0
Hi all,
Any help is greatly appreciated. Environment is UNIX 7 running on p770's, DB2 V9.7.5.

I wanted to move a table from the tablespace it was in to a new tablespace. So, I did the following steps.

1. exported data from prod version of table into .del file(18.5million rows)
2. dropped the table on QA box.
3. recreated just the table in the new tablespace(no indexes)
4. loaded from my .del file (took 4 minutes and change)
5. created the 6 indexes on the table (took < 25 minutes(multiple runs))

ran this several times testing it out to get estimated run times, ensure no issues, etc... Step 5 consistently took 25 minutes to complete. I schedule an hour outage in production to perform the same task. I ran over by a couple of hours. Step 5 took 3 hours to complete. Where in my QA environment this was taking the following average for each index:
ix1 5 minutes 11 seconds
ix2 4 minutes 42 seconds
ix3 2 minutes 15 seconds
ix4 5 minutes 29 seconds
ix5 3 minutes 10 seconds
ix6 5 minutes 36 seconds

In prod took almost 30 minutes per index.

I have compared the DB CFG in both environments there was one difference other than path names. In QA, (MON_UOW_DATA) = NONE whereas in prod I have (MON_UOW_DATA) = BASE. I don't see that being the cause...

I compared the DBM CFG for both again I find one difference.
QA: (SHEAPTHRES) = 20000
ProdL (SHEAPTHRES) = 192000
Again, I don't really see that as being cause. We are looking at DISK config and all now, but I would think I would have seen a big difference on the LOAD step if that were the cause. The load ran for 4 minutes and few seconds on both machines.

Any ideas would be appreciated. Thanks.

Assignment help- very basic

$
0
0
Hi everyone,
I am Ammara and I have an Economics background and then I suddenly thought that I should know more about computers so recently i took "Management information systems" course and to be honest i am struggling; specifically with database management system.
I have this assignment which is confusing me, my purpose of writing here is not to get solution but explanation and hints on which i can do it myself... i will be really obliged if someone here will clear my concepts (if i have any at this point :P )
here is the assignment

Case Study:

A garment brand “Orchid Textile” is using a Retail Management System for management of Sales. It is currently dealing in readymade garments. Mentioned software has following features:
•It will save Product Information like Product Code, Price, Specification related attributes including garment picture. Sales Manager will be able to Save, Delete, Edit and Search Products.
•It will record every transaction details like Trans id, Date, Time and other details.
•Billing invoice will be created against each Transaction. Invoice will have Date, No. of Items, Time, Total Price etc. Sales manager will be able to print invoice
•Admin of Orchid Textile is able to view different reports of Sales like Daily report, monthly report and yearly report. They are also able to view “Top Ten Items Sold “in specific duration.
•Sales Manager is also able to view Stock details to manage items according to customer demand. Moreover, customer data will also be saved to inform them about future promotions.

Questions:
a) Meta Data
b) Draw Detailed Data Flow Diagram

So meta data i guess is

Product code
Price
Record of every Transaction(like Trans id, time and other details)
Stock details
Customer Data

Now as far as making detailed dfd is concerned i am confused how to differentiate entities from process...
i mean if sales manager, admin, customer are entities, what are product and transaction ?

Please someone explain this to me... :S:S:S
Thank you

Hotel reservation Site

$
0
0
Hi I am building this hotel reservation site for a small hotel. The user interface is ready and I have a form that clicking on submit inserts the data into MySQL. My question is where do I go from here? Besides inserting the form data I should be able to verify which rooms are available on a date. Since the hotel is empty when starting should list all the room types singles, doubles etc. After the first booking that room should not be available. Also is my database design right? Here is what I have. Thanks for your help.

TABLES

bookings:

id int11 auto increment primary key
arrival date
departure date
adults int3
children int3

customers:

id int11 auto increment primary key
first_name varchar30
last_name varchar 30
address varchar100\phone int11
city varchar30
country varchar30

rooms:

roomID int11 auto increment primary key
location varchar20
room_number int11
room_typeID int11

room_types:

room_typeID int11 auto increment primary key
room_type vatchar20
num_beds int11
price_night int20

<form name="form1" method="post" action="process.php">
<table border="1" cellspacing="5" cellpadding="4">
<tr><td colspan="2" class="txt"><h2>Book Now</h2></td></tr>

<tr><td colspan="2">&nbsp;</td></tr>

<tr><td class="txt">Arrival:</td><td><input type="text" name="arrival" size="15"></td></tr>

<tr><td class="txt">Departure:</td><td><input type="text" name="departure" size="15"></td></tr>

<tr><td class="txt">Adults:</td><td>

<select id="adults" name="adults">
<option <?php if ($adults == 1 ) echo 'selected'; ?> value="1">1</option>
<option <?php if ($adults == 2 ) echo 'selected'; ?> value="2">2</option>
<option <?php if ($adults == 3 ) echo 'selected'; ?> value="3">3</option>
<option <?php if ($adults == 4 ) echo 'selected'; ?> value="4">4</option>
</select></td></tr>


<tr>
<td class="txt">Children:</td><td>

<select id="children" name="children">

<option <?php if ($children == 0 ) echo 'selected'; ?> value="0">0</option>
<option <?php if ($children == 1 ) echo 'selected'; ?> value="1">1</option>
<option <?php if ($children == 2 ) echo 'selected'; ?> value="2">2</option>
<option <?php if ($children == 3 ) echo 'selected'; ?> value="3">3</option>
<option <?php if ($children == 4 ) echo 'selected'; ?> value="4">4</option>
</select></td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td>&nbsp;</td><td><input type="submit" name="submit" value="Submit"></td></tr>
</table>


<?php include("./includes/connect.php"); ?>

<?php

// Get values from form
$arrival=$_POST['arrival'];
$departure=$_POST['departure'];
$adults=$_POST['adults'];
$children=$_POST['children'];

// Insert data into mysql
$sql="INSERT INTO $tbl_name(arrival, departure, adults, children)VALUES('$arrival', '$departure', '$adults','$children')";
$result=mysql_query($sql);

// if successfully insert data into database, displays message "Successful".
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='index.php'>Back to main page</a>";
}

else {
echo "ERROR";
}
?>

<?php
// close connection
mysql_close();
?>
</form>

SQL Telecoms database dilemma

$
0
0
Hi Everyone,

I'm new to this forum, I would be grateful for your advice. I am working for a price comparison company in London who compare internet deals. The data director asked to me to review the current process through which collect market data, load it onto the database and maintain the database, we currently use SQL server. The UK broadband market is fiercely competitive at the moment and continuously changing. There are constant waves of promotions, e.g.Sky are currently giving tablets and speakers worth £250. The products themselves are also continuously changing with the market shifting towards quad play deals (internet + home phone + TV + Mobile) as a result there are hundreds of different variations of deals that a customer can pick. This has resulted in various hacks to the database to find ways to accommodate these changes. Maintaining the database is also becoming increasingly difficult as we need to have the changes in place first thing in the morning. I was wondering if there are any alternatives to a rational database that could potentially solve this problem. Ideally I would like to present a solution where the retail team in our company who do not have any technical experience could also get involved in maintaining the database. Any advice or pointers in the right direction would be extremely appreciated.
Many thanks in advance.

Hom

Transformation - Columns to lines based on key

$
0
0
Morning / afternoon / evening ladies and gentlemen

As stated in the subject line, I have a table of around 1000 values for a composite key. This looks somewhat like this:


KEY1 KEY2 KEY3 COL VAL

AAA BBB CCC A1 1
AAA BBB CCC A2 2
AAA BBB CCC A3 3
...
...
...
AAA BBB CCC A1000 1000

I need to pivot this data on the composite key which is defined on the only the first 3 columns.

The tricky part begins now. The data from the VAL column needs to be mapped to a destination table where the name of the column is found in the COL column.
The desired result would thus be:


KEY1 KEY2 KEY3 A1 A2 A3 ....... A1000

AAA BBB CCC 1 2 3 ...... 1000

Is this achievable in DB2 LUW 9.5?

Thanks

Tony

Database help, in the subform "You cannot add or change a record because a related"

$
0
0
I am having these error.
"You cannot add or change a record because a related record is required in table"

I am wondering if someone can help me with this problem in the sub-form when i am trying to add the data (glass performance data)
I used the query as my friend said.

I am new to database world if you can correct me if i am wrong in making the database.

Thank you very much in advance and really appreciate your help.

So the relationship in between three table are one customer can have many project and one project can have many glass performance.
So i built the query but i am not sure that is the correct one, basically in the query i added all of the information such as CustName, CustAddress etc plus ProjectID, ProjectName, then in the third table(zKaca...) : GlassID,ProjectID,GlassDesc,etc.

I linked (using relationship) from the first table to the second table by CustID, and the second to the third by ProjectID.
Attached Images
Attached Files

Reg restoring DB with/without logs

$
0
0
Hi experts,

I have a doubt in the restoration of a DB with and without logs. As per my understanding for online backup we need logs to perform the roll-forward and for offline we don't required. Please correct me if I am wrong in this. What I am asking could anybody elaborate it a bit to me or can refer some link where i can this clarification.

Version : DB2 v9.7 LUW

Thanks in advance:beer:

Solution for ACCESS EXECLUSIVE LOCK in table while truncating

$
0
0
Hi ,
I am using postgresql and am working in DW project and while truncating a table .The tables gets locked and it gets "ACCESS EXECLUSIVE LOCK".How to resolve this issue.As of now i am using delete scripts for this.But anyway is there to resolve this issue

Thanks,
Debayan
Viewing all 13329 articles
Browse latest View live