DROP and RECREATE TEMP TABLESPACE
Hey,
is it ok just to drop the TEMP tablespace and recreate it?
Will data get lost? Will developers kill me if I do? ;o)
Can i reuse the datafile?
Is it possible to change name on the tablespace?
Thanks
Kjersti
Hey there is absolutely no problem. Only ensure that only system is logged on and no other user is using the database. Best thing is to shut down the database and restart in restricted session and then create the temp tablespace. give tempfile instead of datafile.
Similar Messages
-
What is the best way to drop and recreate a Primary Key in the Replication Table?
I have a requirement to drop and recreate a primary key in a table which is part of Transaction replication. What is the best way to fo it other than remove it from replication and add again?
Thanks
SwapnaHi Swapna,
Unfortunately you cannot drop columns used in a primary key from articles in transactional replication. This is covered in
Make Schema Changes on Publication Databases:
You cannot drop columns used in a primary key from articles in transactional publications, because they are used by replication.
You will need to drop the article from the publication, drop and recreate the primary key, and add the article back into the publication.
To avoid having to send a snapshot down to the subscriber(s), you could specify the option 'replication support only' for the subscription. This would require the primary key be modified at the subscriber as well prior to adding the article back in
and should be done during a maintenance window when no activity is occurring on the published tables.
I suggest testing this out in your test environment first, prior to deploying to production.
Brandon Williams (blog |
linkedin) -
EMDATABASEControl emca drop and recreate in RAC
Any body know how to drop and recreate EMDATABASEControl (emca) drop and recreate for RAC DB?
use emca -help you can get the parameters used to de-configure and re-configure the emca for RAC
$emca -help
-deleteInst (db | asm) [-silent] [parameters]: de-configure EM for a specified RAC instance
-reconfig dbcontrol -cluster [-silent] [parameters]: reconfigures RAC Database Control deployment -
Synonyms cant be recompiled when the tables are dropped and recreated?
hi
i have a synonym pointing to a table .
1)when i drop and recreate a table.............
isnt it enough to recompile the synonym? do i need to drop the synonym as well and recreate again?
2) when i add new columns to a table will the synonym also show up the new column?
thanks in advance
rajRecompiled is probably not quite the correct word. Re-validated is more like it.
Notice that the synonym goes invalid when the table is dropped, but does NOT become valid when the table is recreated.
That happens the first time it's used (similar to invalid stored procedures).
SQL> drop table t;
Table dropped.
SQL> select object_name, status
2 from user_objects
3 where object_name = 'T_SYN';
OBJECT_NAME STATUS
T_SYN INVALID
SQL> create table t(c number);
Table created.
SQL> select object_name, status
2 from user_objects
3 where object_name = 'T_SYN';
OBJECT_NAME STATUS
T_SYN INVALID
SQL> select * from t_syn;
no rows selected
SQL> select object_name, status
2 from user_objects
3 where object_name = 'T_SYN';
OBJECT_NAME STATUS
T_SYN VALID -
RE: Drop and recreate user
Hi,
If we drop and recreate the oracle user in production database, what advantages we will get?
Any one help me...
DB Version:10.2.04
OS: HP-UX
Thanks,
Srini ...935930 wrote:
Hi,
If we drop and recreate the oracle user in production database, what advantages we will get?
Any one help me...
DB Version:10.2.04
OS: HP-UX
Thanks,
Srini ...The "advantage" (or "disadvantage") would depend on what you are trying to accomplish, correct? -
Drop and recreate table in stored procedure
Hi all
When creating tables using Transact-SQL scripts, I have always preferred to drop the table if it exists and then create it explicitly using CREATE TABLE. For two reasons:
1) It does not matter if it is the first time the SP is run ie. if I create the table manually in the first instance and just use TRUNCATE TABLE it could fail if the table is deleted
2) I have control over the data types of the table fields
Just recently though I discovered the error that can occur when dropping and creating a table in the same batch (see link below)
Microsoft Website
This causes me a problem when dropping and creating tables in stored procedures, as I understand that a stored procedure is in itself a single batch?
Can I avoid this error in a stored procedure whilst continuing to drop and create tables? Or should I be taking a different approach?
Coding best practice advice would be greatly appreciated.
Thank youThanks Ronen
Please see my second post immediately before your reply.
Given that I need to store the data output in a physical table for use in QlikView, would you suggest truncating the table each time the SP runs? And then having a script that handles both dropping and creating the physical table, and also creating
the SP?
>> QlikView
QlikView is an Israeli company, right?
In any case I am not familiar with QlikView's application, therefore I can only give you general information, based on assumptions regarding the application, and facts regarding the SQL Server.
>> for use in QlikView
I assume that external application use specific database structure (table
structure) and it is change only in rare situations (for example CMS interface might change the tables if and when a module s update/install). In this case there is no need to drop the table and recreate it and TRUNCATE is the solution.
>> would you suggest truncating the table each time the SP runs
I am sorry but i cant recommend on TRUNCATE a table each time you execute SP, without know the exact reason for this logic. It sound to me, at this point of time (with the information that we have), that this
is very bad logic (application architecture). As I wrote above, basing your application on TRUNCATING the table each time mean that you have problems with multi users. Thins about 2 people that try to execute the same SP at almost the same time. Think about
locking in the SQL Server and bad data (one truncate while the other already inserted the new data and get no rows, if there is no locking).
But TRUNCATE is much better in this case probably then DROP and DELETE, since it is faster, and locking will be shorter (hopefully the application use the correct locking). There are other reasons why TRUNCATE is better, and other people already mentioned
most of them, but time in this scenario might be critical.
>> having a script that handles both dropping and creating the physical table, and also creating the SP?
I do not undestand what is this second step. we said that you truncate the table, so why do you need to
dropping and creating the physical table and who
creating the SP?
Are you meaning that the application create the tables and SP?
There are lot of application that during installation create the database structure. is this what you mean?
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
What happens if column from idex is dropped and recreated
I have question. I need to drop one column from a table. That column is part of unique index.
If i drop a column and recreate it would it drop index also. Do i need to re-create the index also.
ThanksIs it not possible for you run a quick test on a small table to find out?
-
drop triggers---
CREATE PROC [dbo].[SP_DropTriggers]
AS
BEGIN
DECLARE @Table_Triggers SYSNAME, @trName sysname
DECLARE Cursor_Disabletriggers CURSOR FOR
SELECT object_name(parent_id) , name
FROM sys.triggers
OPEN Cursor_Disabletriggers
FETCH NEXT FROM Cursor_Disabletriggers
INTO @Table_Triggers ,@trname
DECLARE @SQL nvarchar(max)
WHILE @@FETCH_STATUS = 0
BEGIN
SET @SQL = 'drop trigger ' + 'dbo.'+@trname + ' on dbo.'+@Table_Triggers
select @sql
EXECUTE (@SQL)
FETCH NEXT FROM Cursor_Disabletriggers INTO @Table_Triggers ,@trname
END
CLOSE Cursor_Disabletriggers
DEALLOCATE Cursor_Disabletriggers
END
I would like to recreate them in separate proc, How can I achieve this?You need a permanent table to store the trigger code in:
create table
dbo.TriggerDefinitions
(TableName nvarchar(128) not null,
TriggerName nvarchar(128) not null,
TriggerDefinition nvarchar(max) not null,
constraint PK_TriggerDefinitions primary key (TableName, TriggerName))
go
In your procedure which drops the triggers you need to add code that stores the latest trigger definitions in the table above:
create procedure dbo.DropTriggers
as
begin
declare @TableName nvarchar(128),
@TriggerName nvarchar(128),
@TriggerDefinition nvarchar(max),
@DynamicSQL nvarchar(max)
declare TriggerCursor
cursor fast_forward for
select quotename(object_schema_name(po.object_id)) + '.' + quotename(po.name),
quotename(object_schema_name(co.object_id)) + '.' + quotename(co.name),
m.definition
from sys.sql_modules as m
join sys.objects as co
join sys.objects as po
on po.object_id = co.parent_object_id
on co.object_id = m.object_id
where co.type = 'tr'
open TriggerCursor
fetch next
from TriggerCursor
into @TableName,
@TriggerName,
@TriggerDefinition
while @@fetch_status = 0
begin
if exists(select top 1 1 from TriggerDefinitions where TableName = @TableName and TriggerDefinition = @TriggerDefinition)
update TriggerDefinitions
set TriggerDefinition = @TriggerDefinition
where TableName = @TableName
and TriggerName = @TriggerName
else
insert TriggerDefinitions
values (@TableName, @TriggerName, @TriggerDefinition)
if @@rowcount = 1
begin
set @DynamicSQL = 'drop trigger ' + @TriggerName + ' on ' + @TableName
print @DynamicSQL
--execute sp_executesql
-- @DynamicSQL
end
fetch next
from TriggerCursor
into @TableName,
@TriggerName,
@TriggerDefinition
end
close TriggerCursor
deallocate TriggerCursor
end
go
Finally the procedure which will re-create the triggers will simply query the table created and populated above and execute the code contained therein.
create procedure dbo.CreateTriggers
as
begin
declare @TableName nvarchar(128),
@TriggerName nvarchar(128),
@TriggerDefinition nvarchar(max),
@DynamicSQL nvarchar(max)
declare TriggerCursor
cursor fast_forward for
select *
from dbo.TriggerDefinitions
open TriggerCursor
fetch next
from TriggerCursor
into @TableName,
@TriggerName,
@TriggerDefinition
while @@fetch_status = 0
begin
set @DynamicSQL = @TriggerDefinition
print @DynamicSQL
--execute sp_executesql
-- @DynamicSQL
fetch next
from TriggerCursor
into @TableName,
@TriggerName,
@TriggerDefinition
end
close TriggerCursor
deallocate TriggerCursor
end
go
I've commented out the code which actually runs the dynamically created SQL. You'll have to uncomment those lines for the code I've posted will work. -
SSIS Package drops and recreates constraint
My SSIS package is apparently dropping a constraint and later recreating it. So I deleted the constraint. When I reran the package the constraint was back. Somewhere in the package in a location I can't see/don't know about is the information
on the constraint. The primary purpose of the package is a number of Data Flow Tasks.I just did a search and the drop is there. And so is the code to add the constraint.
Both are in elements of <DTS:LoggingOptions>
Is there anyway to get rid of it without an XML edit?
Strange. That node describes merely some logging options for the SSIS package (like which log provider is used).
Is logging enabled in the package and what is configured over there?
MCSE SQL Server 2012 - Please mark posts as answered where appropriate. -
How to drop and recreate dbconsole in RAC?
Hi Guys,
I might not be in the right Forum area, so apologize for that. Here is my dilemma, I restored a database (10.2.0.3 on RHEL4AS) from standalone to 2-Node RAC Cluster (10.2.0.3 on RHEL4AS) and now need to recreate dbconsole. I see quite few articles on create dbconsole on a single standalone but having hard time finding how to recreate dbconsole in RAC. Any help will be a great help to me.
Thanks,
--MMYou can check this part of Oracle Doc, use EMCA to reconfigure.
Using EMCA with Real Application Clusters
http://download.oracle.com/docs/cd/B19306_01/em.102/b40002/structure.htm#sthref80 -
Emca drop and recreate for RAC DB.
metalink notes Note:315299.1 discuss the same problem
Now question is
1-What are the steps to Recreate the Database Control configuration files:
& what -x and -r flags are doing ? can i run simple emca and do the job? I am in RAC environment.
./bin/emca -x <sid>
./bin/emca -rYou can add the -cluster parameter.
Read more about it in the documentation -
Drop and create tablespace for users
I am using Oracle 8i. I have created some users and, assigned the default & temporary tablespace to them.
I would like to drop and re-create the temporary tablespace, should I assign the tablespace to users again?
my script for creation of users:
CREATE USER USER01 IDENTIFIED BY ABC
DEFAULT TABLESPACE WEB_DATA
TEMPORARY TABLESPACE TEMPORARY_DATA
PROFILE DEFAULT;Hi,
I would like to drop and re-create the temporary tablespace, should I assign the
tablespace to users again?If temp tbs is not in usage, you can drop and recreate it without reassign. Users keep this one.
Nicolas. -
Emca configuration/ How i can drop existing emca and recreate it?
emca configuration/ How i can drop existing emca and recreate it?
Hmmmm?
emca is the program used to create/drop/update the em configuration. Not sure why you want to drop emca.
If you want to drop and recreate the em configuration, have you tried "emca ?" or "emca help=y" -
Newbie: dropping and creating an identical user
Oracle 10g
Hi: I need to drop and recreate the user. This is what I had from my previous notes.
1. how do I figure out what is the current default tablespace
2. how do I figure out the current temporary tablespace?
3. the table space and temporary table space get deleted when I drop the user. if Yes, Is it possible some other user's default tablespace and temporary tablespace is the same as well.
Drop user systems cascade;
CREATE USER SYSTEMS
IDENTIFIED BY VALUES 'Test123'
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMPts1
PROFILE DEFAULT
ACCOUNT UNLOCK;
/When I do a "SELECT DBMS_METADATA.GET_DDL('USER', 'Test123') || '/' DDL FROM DBA_USERS;", I get 34 rows. What does that mean. They all look identical.
SELECT DBMS_METADATA.GET_DDL('USER', 'Test123') || '/' DDL FROM DBA_USERS;
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
CREATE USER "Test123" IDENTIFIED BY VALUES 'F42EB0B11017F065'
DEFAULT TABLESPACE "ARSYSTEM"
TEMPORARY TABLESPACE "TEMP"
34 rows selected. -
Temp tablespace - why so big?
Temp tablespace (size 6gb) is twice the size of my data and index tablespace combined. I am running into space issues and am wondering is it possible to resize this tablespace and/or take some other action to prevent the temp tablespace getting so relatively large?
Thanks in advance.The Temporary Tablespace holds only 1 Temporary Segment shared all by all user sessions. Each session takes one or more extents. When a session finishes its operation, it "releases" the extent it used for use by another session but the size of the Segment does NOT shrink.
Therefore, the Segment would grow to the peak concurrent temporary extent usage -- eg at some point in time, if you had 4 very large queries running concurently taking up 8GB then the segment would have grown to 8GB. However, even if you never have such concurrent usage (for example the normal load is for 20 users concurrently taking up 500MB only !), the segment remains at 8GB.
In some environments, the Temporary tablespace could grow during periodic (say Monthly Reporting) batch jobs after which it is dropped and recreated again.
This segment is used not just for "SORT" operations. It is also used for HASH JOIN overflows to disk and also for SORT MERGE operations.
You can monitor the size of the segment in V$SORT_SEGMENT. You can monitor users currently using it in V$SORT_USAGE or V$TEMPSEG_USAGE.
Hemant K Chitale
http://hemantoracledba.blogpsot.com
Maybe you are looking for
-
Hello all, I have a situation where I have a third party order with 3 line items. Line item 30 is free. When a pur req is created it has only item 10 and 20 in there and not the 30. And since the PO is copied from the pur req, the PO is also minus it
-
How do I stop PSE8 from overwriting raw files?
I evidently did something wrong. I wanted to edit my camera raw file but save the finished product as a JPEG. When I was finished, I noticed the raw file is now changed the same as the JPEG. I made edits in Adobe Camera Raw Editor and clicked on Op
-
My video is 1080p, 30fps. After editing in CS4, I'm exporting via Adobe Media Encoder to make a blu-ray DVD. Using H.264 I want to export with 1440x1080p 30fps (or 29.97 fps) but that choice is unavailable. Do I use: 1440x1080i 29.97 HQ 1440x1080p 23
-
Adobe CreatePDF Online Combine
Errore Impossibile completare la richiesta di conversione PDF. Si è verificato un problema inatteso durante la combinazione dei file in un singolo file PDF. Riprovate più tardi.
-
I just received an IPAD. My main purpose is to be able to access my Realtor Mls Sites for business. They are only compatable with Internet Explorer not Safari. Does anyone know of an APP that may help me.