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?
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 -
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] -
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
KjerstiHey 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.
-
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 -
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. -
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" -
How to drop and import the tables
i got some tables that need to be dropped and recreated.It has got a PK with on delete cascade constraint.I need to drop and import those tables.How can i ddo this.
Can i diable the constraints on these tables and import?Well, in that case I would not drop the user! Another thing to consider would be an import into temp/staging tables and then merging into the target tables. You would need to order so that RI constraints would not fire. The nice thing about this is that you could still use the tables as you were loading.
Maybe you are looking for
-
When I click on a link in Mail, Safari crashes on my MacBook.
I'm running OS X 10.6.8, Safari 5.1.2, on a Mac Book 1. I've tried checking for software updates, ran disk permission repair, and cleared my cache. It doesn't happen every single time I go from Mail to a website, but about 90% of the time today, Safa
-
Hi, I'm new to the forum and hope I can get help here. I have a HP Officejet Pro 8600 and it doesn't print since I updated my late 2009 iMac and my new MacBook Pro to OS X Yosemite (it used to work just fine with Mavericks). I am connected via wifi.
-
When I Update My Nano, I get error message, "file not found"
When I Update My Nano, I get an error message, "file not found, cannot update iPod". I have looked through the manual and tried reinstalling the iTunes program but it still won't update my iPod with music or pictures. PLease help.
-
How do I cancel that association of my iPhone 4S with an Apple ID
my child took my iPhone without my permission and he started downloading song with his Apple ID, somehow he associated his ID with my iPhone, now I want to download old purchases and when I tap on "download" it appears a message that tells me "an iPh
-
Launch Concurrent through Personalization with default parameters
Hi, I have one requirement as follows: Through personalization -> Buil-in -> Launch SRS from, I want to call one concurrent program with parameters. This concurrent should run as backround process. I like to use "Launch SRS form" or "execute a Proced