Fastest way of deleting a DIT

Hi,
We have a chained suffix which is connected to 4 back end suffixes. Each of these 4 suffixes have their counterparts in another node, and they have a replication agreement.
And the whole system is duplicated on another geographical redundancy center.
4 + 4 in the main data center
4 + 4 in the geographical data center
A total of 16 slapd instances are running, and they are all suppliers (writable) with 4 way multi-master configuration in place :).
My question is, i want to delete all the entries under a suffix, and i want it to be very fast. And also, i don't want any trouble regarding these replication agreements during the delete operation. Version is 5.2.
What is the fastest, trouble free way to do it?
Thanks for your time and best regards,
Ogun

If you mean fast in terms of the human effort, then I've done the following at the Unix shell (or cygwin's bash for Windows users). This will not be the most efficient for system resources, but often the human effort and time far exceeds the system effort.
*** USE AT YOUR OWN RISK, IT'S EASY TO MAKE A BIG MISTAKE. ***
TRY LOOKING AT THE RESULTS OF EACH STEP TO MAKE SURE IT'S WHAT YOU WANT BEFORE GOING ON TO THE NEXT STEP.
With multi-master replication make sure all your work for this session will hit exactly one server (and always the same one). Let replication do its job.
It's probably much safer to make sure that ALL referrals, aliases, and the like within your target area are deleted before proceeding.
(1) Run ldapsearch to get the DN (and only the DN) to list all the entries you want to delete. Be sure to use the ldapsearch from the DSRK with the "-T" option so that it doesn't wrap the lines (which makes things very unpleasant).
If you have any entries which are hidden from anonymous searches then make sure to bind your ldapsearch with an appropriate identity.
(2) Pipe the results through egrep so that only the dn: lines are matched (the regexp '^dn: ' will do this.
(3) Pipe the output through sed to strip off the leading "dn: " (the command "sed -e 's/^dn: //'" should do this).
(3a) Directory Server 5.2 (and probably others) will happily delete the entry at the top of the suffix. If you don't like this then run the results through egrep -v to exclude the suffix's DN. Make sure that your regular expression will actually match the suffix's DN as returned by ldapsearch.
If you do accidentally clobber the entry and wish to retain it, the 5.2 Directory Server Console has an option to recreate that entry.
Now you've got the DN's to delete.
(4) Optionally find a way to sort these according to their hierarchy. This is relatively easy to do in perl or other high powered scripting languages, but it's moderately annoying to do in the shell (I would actually use perl -e from a shell script here).
If I'm feeling lazy I often won't bother sorting it. Instead I'll give the "-c" flag to ldapdelete (in step 5) so that it will continue beyond the errors for the non-leaf containers. Then I'll just hit up arrow and repeat the process (the ldapsearch results should get smaller on every pass). Keep repeating until you've cleaned up the tree.
(5) Take that (possibly sorted) list of DN's and feed it to ldapdelete.
If you're like me and build complex shell commands at the command line you can do this all in a single pipeline for a one-time action. Make sure to test the output of each stage of the pipeline before proceeding. I've omitted options which aren't important for understanding.
THIS NEEDS TO BE TAILORED TO YOUR NEEDS BEFORE USING IT. DON'T USE THIS IF YOU DON'T UNDERSTAND IT. USE AT YOUR OWN RISK.
THERE IS NO ERROR HANDLING OR CHECKING IN THIS EXAMPLE, IT IS DEPENDENT ON THE USER DOING ALL ERROR HANDLING. BECAUSE OF THIS IT SHOULD NOT BE PLACED INTO A SCRIPT WITHOUT APPROPRIATE ERROR HANDLING.
(Make sure to use the ldapsearch & ldapdelete from the DSRK, these should be in $serverroot/shared/bin). This doesn't bother sorting hierarchically and uses -c for ldapdelete instead (which has its own downsides).
$ ldapsearch -T -h 'server1' -D 'admindn' -w - -b 'basedn-for-deletion' -s sub '(objectClass=*)' dn \
    | egrep '^dn: ' \
    | sed -e 's/^dn: //' \
    | egrep -v '^basedn-for-deletion$'
    | ldapdelete -T -h 'server1' -D 'admindn' -w - -cYou'll have to enter the password for admindn twice, and it's possible you might not see a password prompt.
-Scott-

Similar Messages

  • There are over 4000 duplicates in my iTunes. What is the fastest way to delete them?

    There are over 4000 duplicates in my iTunes. What is the fastest way to delete them?

    Hello there, yandere69keita.
    The following Knowledge Base clarifies your concern about your My Photo Stream counting towards your iCloud storage:
    iCloud: My Photo Stream FAQ
    http://support.apple.com/kb/ht4486
    Does My Photo Stream use my iCloud storage?
    No. Photos uploaded to My Photo Stream do not count against your iCloud storage.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • What is the fastest way to delete duplicate songs?

    I will spend hours deleting songs from the duplicate veiw unless someone has a faster way to delete duplicates.

    Import the photos with your computer as with any other digitial camera. Most computer photo importing apps include an option to delete the photos from the camera after the import process is complete.
    Or select Edit followed by selecting multiple photos that you want to delete followed by selecting Delete.

  • What is the fastest way to delete photos from My Photo Stream?

    Is there an easier way to delete my hundreds of photos from My Photo Stream album than individually delete them from my iPhone? They're wasting the available storage, but will take a long time to delete all of them.

    Hello there, yandere69keita.
    The following Knowledge Base clarifies your concern about your My Photo Stream counting towards your iCloud storage:
    iCloud: My Photo Stream FAQ
    http://support.apple.com/kb/ht4486
    Does My Photo Stream use my iCloud storage?
    No. Photos uploaded to My Photo Stream do not count against your iCloud storage.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • What is the fastest way to delete photos on the iphone?

    Is there a way to delete old photos that have been taken on my phone any other way than one picture at a time??  I am wanting to free up some memory......

    Import the photos with your computer as with any other digitial camera. Most computer photo importing apps include an option to delete the photos from the camera after the import process is complete.
    Or select Edit followed by selecting multiple photos that you want to delete followed by selecting Delete.

  • Fastest way to Delete More than 20 Million Rows

    Hi
    We have a Huge database with about 20 tables having more than 1 billion rows each.
    I need to delete more than 20 million of rows from each of those tables and the delete should also reflect on the Standby databases. Please suggest me a Fastest and best approach.
    P.S : I cannot perform 'Create table new as select * from old where ....' due to lack of Disk Space.
    Regards
    Mudassir.

    Mudassir wrote:
    We have a Huge database with about 20 tables having more than 1 billion rows each.
    I need to delete more than 20 million of rows from each of those tables and the delete should also reflect on the Standby databases. Please suggest me a Fastest and best approach.
    P.S : I cannot perform 'Create table new as select * from old where ....' due to lack of Disk Space.
    Do you need the entire delete to complete as a single transaction, or can you delete and commit each table separately ?
    How many indexes do you have on these tables, and are they split between local and global.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    There is a +"Preview"+ tab at the top of the text entry panel. Use this to check what your message will look like before you post the message. If it looks a complete mess you're unlikely to get a response. (Click on the +"Plain text"+ tab if you want to edit the text to tidy it up.)
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Fastest Way to Delete a large number of data

    I m trying to delete a large number of Data
    this Proc will be running every day without disturbing the other Process
    SET sql = 'DELETE TOP (100) FROM ' + @TableName + ' WHERE Id IN (Select Distinct Id FROM [state] WHERE ToDel = 1)'SET @Deleted_Rows = 1;SET @Rows = 0; WHILE (@Deleted_Rows > 0)BEGIN BEGIN TRANEXEC sp_executesql @sql SET @Deleted_Rows = (SELECT @@ROWCOUNT);SET @Rows = (@Rows + @Deleted_Rows);COMMIT TRANWaitFor DELAY '00:00:00:01' END
    Have you any Idea how can I optimize my Query ?
    Thank you very much

    Hi, following are few thoughts.
    1. If you can manage without dynamic sql then it may yield better performance as except table name there is no need for it as per your query.
    2. Ensure indexes are in place.
    3. If the table in question is not participant in replication then you may slightly go for higher batch size and again it depends on volume.
    Please take a look at the tweaked code.
    declare @Deleted_Rows int, @Rows int;
    SET @Deleted_Rows = 1;
    SET @Rows = 0;
    WHILE (@Deleted_Rows > 0)
    BEGIN
    BEGIN TRAN;
    DELETE TOP (100) t1
    FROM
    tabName as t1
    WHERE exists (Select * FROM [state] as t2 WHERE t2.ToDel = 1 and t2.Id = t1.id);
    SET @Deleted_Rows = @@ROWCOUNT ;
    SET @Rows = @Rows + @Deleted_Rows;
    COMMIT TRAN;
    WaitFor DELAY '00:00:00:01';
    END
    Print 'Total rows deleted : '+convert(varchar(50), @Rows);

  • What is the quickest way to delete personal info prior to recycling?

    We are downsizing and my trusty iMac (10 years old I think) has to go, what is the best way to delete personal stuff?

    The preferred and/or fastest method to ensure removal of all personal data depends on whether the computer is going to the recycling heap for safe disposal or whether it will be given/sold to a future user.  In the former case, removing and keeping the hard drive can  be the fastest way to do so, but that depends on the design of the computer in question.  Since you have a 10 year-old iMac, I'll assume it's an iMac G4.  Hard drive removal is more involved for that model, than it is for other Macs that can be opened quickly.  The other method is to boot the computer from the installer disk, run Disk Utility and select the hard drive to erase and reformat as a Mac OS Extended volume.  Choose the option to "write zeros" to the drive, as this will overwrite the existing data.  It takes longer, but you indicated that you wanted to remove personal info.  If you're donating the computer to an organization for future use, re-install the OS and include the original disks.

  • What is the fastest way to transfer files and applications from an older iMac to a new MacBook Pro?

    What is the fastest way to transfer files and applications from an older iMac to a new MacBook Pro?
    I have a Firewire cable and Thunderbolt adapter, but no icons showing either Mac appear on either desktop.

    The fastest way is to use Carbon Copy Cloner and a external drive formatted GUID OS X Ext. J in Disk Utlilty, then connecting to the new Mac and using Migration Assistant in the Utilites folder.
    Even faster, if you can determine your going to replace all the apps from fresh sources anyway (like if the older Mac's OS X verison is old thus the apps) then just use a external drive and copy just your files to it, then connect to the new Mac and transfer over.
    Some apps you can just grab the registration code and install it fresh on the new machine with the old code, talk to the developer about transfering the program, as long as it's deleted on the older Mac in the process.
    It used to be Firewire Target disk mode was fastest, but since Thunderbolt came out...
    Notice this support doc hasn't been updated since june 2012, no Thunderbolt info
    https://support.apple.com/kb/HT1661

  • Fastest way to check total number of rows from View ?

    Hello Everyone,
    Good Morning !!!!
    I am trying to know the exact number of rows from a view.
    I have total 262 columns in a view name vw_sample. First column name is col_1 and I do not have permission to view that. but I do have permission to view all other 261 columns. I want to know fastest way to know exact number of rows in this view vw_sample.
    How can i know that ?
    I tried below things.
    1) Tried using COUNT(*) & COUNT(1) but I don't have permission to first column col_1 so that didn't worked.
    2) I do not have permission to view DMV "sys.dm_db_partition_stats"
    3) I tried to execute below code.
    select col_2, col_3,...col_262
    into #TempTable
    from vw_sample
    and it gave me below error
    Msg 1105, Level 17, State 2, Line 1
    Could not allocate space for object '<temporary system object: 9830433781072176840>'
    in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
    4) Accidentaly I run below code
    select col_2, col_3,...col_262
    from vw_sample
    It gave me 11 million rows in 40 minutes. As we know this method is not good to test just number of rows from a view.
    So what would be my option here ?
    Thanks in advance.
    Thanks
    Fredyy

    Fredy, did you try with other column names instead of col1?
    SELECT COUNT(col2) FROM View
    What difference does that make, than using your column 1.
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
    IMO, sqlsaga's answer is the way to go, but you may need to make a minor change.  When you do COUNT(<some expression>), SQL counts the number of rows where <some expression> is not NULL.  So if col2 can be NULL you need to make a change
    so you know what you are counting can't be NULL.  If there is some other column in the view that can't be NULL, just count it.  Otherwise just use the ISNULL function to convert NULL's to a value.  For example, do
    Select COUNT(IsNull(col2, 0)) From vw_sample
    Note the above assumes that col2 is a type that contains a number (int, numeric, float, etc).  If col2 is of a different type, then just replace the 0 in the above with any valid value of the same type as col2 (so '' for varchar, '19000101' for datetime,
    etc).
    Tom

  • Fastest way of re-deploying j2ee applications

    I am using Iplanet Application server to deploy j2ee applications. I want to know the fastest way to redeploy whole application after making some changes in JSPs, Servlets and EJBs?
    Do i have to pack the whole ear again and then re-deploy it again to see the changes or there is any alternative?

    If change is done in JSPs, u can test it copying in public_html folder in J2EE. And when JSPs are finalized make EAR file and redeploy it.But for EJBs u have to redeploy the EAR file again. Remember public_html folder contains files teporarily, if application is undeployed all the files are deleted.

  • Ok Apple users...Is there a way to delete e-mails on my Mac and not have to delete the same e-mails on my iPhone, and iPad...and vise-versa. I have the Cloud, and thought that everything would sync all of the time. If you know of a setting I need to adjus

    Ok Apple users...Is there a way to delete e-mails on my Mac and not have to delete the same e-mails on my iPhone, and iPad...and vise-versa. I have the Cloud, and thought that everything would sync all of the time. If you know of a setting I need to adjust, please let me know.

    Are you referring to @mac.com, @me.com or @icloud.com emails? Or some other email providers emails?
    If the former, it should do that automatically. If the latter, no. iCloud does not (nor is it supposed to) sync non-Apple provided emails.

  • Is there a way to delete only cookies in safari 5.1?

    Is there a way to delete only cookies in safari 5.1?
    If you go to Preferences -> Privacy -> details, you can choose to remove "website data" but sometimes this includes the local cache and also local storage.
    Is there any way to delete JUST/SOLEY the cookies that the browser stores?

    Go to ~/Library/Cookies.
    Move the Cookies.plist to the Trash.
    ~ (Tilde) character represents the Home folder.
    For LIon:   To find the Home folder in OS X Lion, open the Finder, hold the Option key, and choose Go > Library

  • I have a 3g iphone and I need to know how to delete old photos from my phone!! I need the space but there is no way to delete the pictures!! Help!!!

    I have a 3g iPhone and I need to know how to delete old photos. Need to free up space and there is no clear way to delete these photos!! Can someone please let me know how to get rid of these pictures!!!! Help!!!

    There are a number of ways to delete pictures from the Camera Roll.  One is to open Camera Roll in the thumbnail view, tap the arrow button (top right), tap all the pictures you want to delete, tap the Delete button ant the bottom.  Photo Library pictures are deleted by unchecking Sync Photos on the Photos tab of your iTunes sync settings, followed by syncing your phone.

  • Is there a way to delete multiple pictures at the same time from the iphone4s?

    Is there a way to deleter multiple pictures at the same time, from my iphone4s? I know how to delete one at a time. Thanks

    Open your Photos App > Camera Roll > At the top right corner you will see a rectangle with a right arrow, select that. Now you can select as many photos as you want and you can hit the red Delete button on the bottom right.

Maybe you are looking for

  • HTTP Receiver Adapter: Payload in SXI Monitor

    Hi We have a scenario where System A is sending information by HTTP to SAP XI    (No Sender HTTP Adapter required). SAP XI is posting an Idoc in R/3 and sending back two fields to same sender. We have defined 2 Receiver determination, one for Idoc an

  • Feature Request "Copy of column-name" in 2.1.1 not working

    Scanning all the feature requests added to 2.1.1, i came across to the following one: Title: Copy of column-name Description: after getting the query result it would be greate if we can mark the column-name and the copy the name of the column to the

  • Can't transfer e-book to another computer

    I'm using Windows Vista, Adobe Digital Editions v 1.5, I purchased an ebook online, and I'm trying to transfer the ebook to another computer for printing. I followed all the instructions online for transferring ebooks, and logged onto the other compu

  • Error with nokia updater

    ive just downloaded the nokia software updater and while im tryin to install it this error appears "error:2738 could not access VBScript run time for custom action" so what might be the problem?

  • Error during deployment writing deployemnt cache

    I get this error every time I try to deploy from JDeveloper to oc4j. Only shutdown and redeploy works. Error instantiating compiler: IO error writing cache: D:\oc4j\j2ee\home\applic ation-deployments\App\Appejb.jar\deployment.cache It might have some