Script for adding datafile to tablespace

Hi
Does anyone have a template alter tablespace add datafile script handy?
Basically, we need to, in the event of a tablespace alert, do two things:
query that tablespace to see how much space is remaining.
ascertain the size of the datafiles added to that tablespace already (to clarify what size we should make the additional datafile)
finally, the command itself for adding the extra datafile.
Thanks.
10.0.2.0

SELECT Total.tablespace_name "TSPACE_NAME",
round(nvl(TOTAL_SPACE,0),2) Tot_space,
round(nvl(USED_Space,0),2) Used_space,
round(nvl(TOTAL_SPACE - USED_Space,0),2) Free_space,
round(nvl(round(nvl((TOTAL_SPACE - USED_Space)*100,0),2)/(Total_space),0),2) "USED%"
FROM
(select tablespace_name, sum(bytes/1024/1024) TOTAL_SPACE
from sys.dba_data_files
group by tablespace_name
) Total,
(select tablespace_name, sum(bytes/1024/1024) USED_Space
from sys.dba_segments
group by tablespace_name
) USED
WHERE Total.Tablespace_name(+) = USED.tablespace_name and
round(nvl(round(nvl((TOTAL_SPACE - USED_Space)*100,0),2)/(Total_space),0),2)< 20;
the above query will display tablespaces which are having freespace below 20%
select file_name,autoextensible,sum(bytes)/1024/1024,sum(maxbytes)/1024/1024
from dba_data_files
where tablespace_name='TBS_NAME'
group by file_name,autoextensible;
the above query will give details of datafiles like autoextensible or not etc.
SELECT SUBSTR (df.NAME, 1, 40) file_name,dfs.tablespace_name, df.bytes / 1024 / 1024 allocated_mb,
((df.bytes / 1024 / 1024) - NVL (SUM (dfs.bytes) / 1024 / 1024, 0))
used_mb,
NVL (SUM (dfs.bytes) / 1024 / 1024, 0) free_space_mb
FROM v$datafile df, dba_free_space dfs
WHERE df.file# = dfs.file_id(+)
GROUP BY dfs.file_id, df.NAME, df.file#, df.bytes,dfs.tablespace_name
ORDER BY file_name;
the above query will show how much freespace is left in each datafile.

Similar Messages

  • Script for adding a login item for all accounts in the system

    Hi,
    Thanks for reading this query. I am new to the mac environment. I have developed a java application and created an installer of this application for MAC system.I want to run this application on starting the system. So I have written an apple script for adding this application in login items and this script will run immediately after completing installation process. And the entire process is fine. But the problem is, the application is added to login items of only the user who installed the application. But I want to get available the application in the login list of all accounts created in the system. How can I achieve this? Once more thanks in advance. I am attaching my script below:
    +*tell application "System Events"*+
    +* make login item at end with properties {path:"/Applications/MyApplication.app", hidden:true}*+
    +*end tell*+

    Hi,
    Try to use tables RSOSFIELDMAP, RSDSSEGFD and RSTRAN
    Hope it helps
    bhaskar

  • Scripts for adding/deleting/modifying Open Directory accounts?

    I think I have searched high and low for an answer to this question, but if I missed it please point me in the right direction. Where can I find information on scripts for adding/deleting/modifying open directory accounts? At the very least, a command line utility with some syntax guidelines! Any help would be greatly appreciated.

    Hi
    I personally don't know if any scripts although you can use the command line to do pretty much anything you want with the Open Directory. Consult the manual: man dscl. If you launch terminal and issue dscl you should see something like this:
    my-Laptop:~ me$ dscl
    dscl (v20.4)
    usage: dscl [options] [<datasource> [<command>]]
    datasource:
    localhost (default) or
    <hostname> (requires DS proxy support, >= DS-158) or
    <nodename> (Directory Service style node name) or
    <domainname> (NetInfo style domain name)
    options:
    -u <user> authenticate as user (required when using DS Proxy)
    -P <password> authentication password
    -p prompt for password
    -raw don't strip off prefix from DS constants
    -url print record attribute values in URL-style encoding
    -q quiet - no interactive prompt
    commands:
    -read <path> [<key>...]
    -create <record path> [<key> [<val>...]]
    -delete <path> [<key> [<val>...]]
    -list <path> [<key>]
    -append <record path> <key> <val>...
    -merge <record path> <key> <val>...
    -change <record path> <key> <old value> <new value>
    -changei <record path> <key> <value index> <new value>
    -search <path> <key> <val>
    -auth [<user> [<password>]]
    -authonly [<user> [<password>]]
    -passwd <user path> [<new password> | <old password> <new password>]
    Entering interactive mode...
    The above is for 10.4 and should server equally as well for 10.5.
    Hope this helps, Tony

  • Best / most popular software or scripts for adding search function to website?

    I'm trying to find a good piece of software or script for implementing a site search function into our website.  I am relatively knowledgeable in Dreamweaver and can write CSS and XHTML at the fairly intermediate to advanced level, as well as work with JavaScript and js files, but I don't really know much ASP or "by hand" Java coding.  Their are so many scripts and software out there for adding a site search that it's hard to sort through and narrow down.  I was hoping to find reviews of the popular ones or "top 10 lists" of some sort that would help me pinpoint a good one, but can't find anything like that.  These are the primary needs of the website:
    --Has under 50 searchable pages that won't change much and probably won't exceed 50. There are product part numbers and descriptions for some 250-300 part numbers, spread across only 24 of those pages.  The remaining pages are important but no part numbers-- About Us, News, Where to Buy, History, Featured Products, etc.  The product pages are very much like an online store but we don't sell directly on the site (only thru distributors/reps).
    --We are trying to keep the price under about $50, or use a free solution
    --The pages are all static XHTML+CSS pages, but our server can run ASP (we have another website for one of our other product line divisions, on the same server, with many more products beyond 1000, which was programmed completely in ASP by an outside company about 4 years ago).  We self-host both sites.
    --Our server can't run PHP
    --The search capabilities need only be rather basic-- a keyword search with a results page that uses the same design template as the rest of the site.  It would be nice, but not mandatory, to have a search filter and/or a drop down menu to enable selectively searching only certain parts of the site, or only product/part number search vs. general search, etc. (but again, not mandatory).
    --I do have a sitemap page already on it, if that matters or helps
    Some of the ones I've found so far that looked the most promising include:  Zoom Search Engine (http://www.wrensoft.com/zoom/), Site Search Pro (http://www.site-search-pro.com/), and FX Site Search which is a DW Extension I found in the exchange (http://www.felixone.it/extensions/prod/mxssen.asp)-- (that one looks possibly technically challenging or requiring more ASP skill, though)
    Forgive me if there is a better area to post this, if so let me know.

    For a static site, your options are:
    Google ~  http://www.google.com/sitesearch/
    Freefind ~ http://www.freefind.com/
    Zoom from Wrensoft ~ http://www.wrensoft.com/zoom/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/

  • Required alter script for adding partition and subpartition

    Hi Folks,
    Please help me to write ALTER STATEMENT for adding new partition P1 and SUBPARTITION P1_201001 and P1_201002.
    Thank you
    TABLE
    =======
    CREATE TABLE TEST
         "REPORT_ID"    NUMBER,
        "MONTH_ID"      NUMBER,
        "GROUP_ID"      NUMBER,
        "AGE_GROUP_ID"  NUMBER,
        "GENDER_CD"     CHAR(1 BYTE),
    PCTFREE 0 PCTUSED 0 INITRANS 1 MAXTRANS 255 COMPRESS BASIC NOLOGGING STORAGE
        BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
      TABLESPACE "USER_WORK" PARTITION BY RANGE
        "REPORT_ID"
      SUBPARTITION BY LIST
        "MONTH_ID"
      SUBPARTITION TEMPLATE
        SUBPARTITION "M201212" VALUES
          201212
        TABLESPACE "USER_WORK"
    (PARTITION "P3" VALUES LESS THAN (4) PCTFREE 0 PCTUSED 0 INITRANS 1 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "USER_WORK" COMPRESS BASIC NOLOGGING ( SUBPARTITION "P3_M201212" VALUES
          201212
        TABLESPACE "USER_WORK" COMPRESS BASIC, SUBPARTITION "P3_M201301" VALUES
          201301
        TABLESPACE "USER_WORK" COMPRESS BASIC )
    );

    First modify the subpartition template
    ALTER TABLE TEST set
      SUBPARTITION TEMPLATE
        SUBPARTITION "M201212" VALUES
          201212
        SUBPARTITION P1_201001 VALUES (201001),
        SUBPARTITION P1_201002 VALUES (201002)
      )Then if the new partition is HIGHER than ALL existing ranges you can just add it
    alter table test add
    PARTITION "P1" VALUES LESS THAN (5) If the new partition is LOWER than one onf the existing ranges you will need to SPLIT the existing partition.
    alter table test SPLIT PARTITION "P3" AT (2)
    INTO (PARTITION P1, PARTITION P3)See the sections in the VLDB and Partitioning Guide
    Modifying a Subpartition Template
    http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1007904
    Splitting a Partition of a Range-Partitioned Table
    http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1008028

  • A script for adding the current date to file name?

    I am working in Indesign CS3. I frequently save file as PDFs into a designated folder. I was hoping for help in writing a script that would apply the current date to the end of the file name, when saved into this folder. Some days, I save the same file several times, into this folder. I was also hoping there was a way to add a date and version, for example "filename_2.25.11(1).pdf" Is this possible? Can someone help me?

    ok, I ended up with this test routine:
    on adding folder items to this_folder after receiving added_items
    tell application "Finder"
    repeat with this in added_items
    my checkifopened(this)
    display dialog (name of this) as text
    end repeat
    end tell
    end adding folder items to
    on checkifopened(this)
    set a to POSIX path of (this as alias)
    repeat until 1 = 0
    ## don't like that one because it relies on an error msg ... so
    (** try
    set b to do shell script "lsof | grep " & quoted form of a
    on error
    exit repeat
    end try**)
    ##so I use this one
    set b to do shell script "lsof"
    if b does not contain a then
    exit repeat
    else
    say "still opened"
    end if
    end repeat
    end checkifopened
    this is a folder action that tests if the added file is still opened by an application... there is no delay between each test-loop since lsof takes some time to execute...
    And after adding a timeout (just in case) to this function the final script looks like this:
    on adding folder items to thefolder after receiving added_items
    tell application "Finder"
    set folderkind to kind of thefolder
    set myfiles to every item of thefolder whose name does not contain "#" and kind is not folderkind
    repeat with myfile in myfiles
    set myfile_datestring to my get_datestring(creation date of myfile)
    set myfilename to name of myfile
    if (count of every character of myfilename) > 4 and (character -4 of myfilename) as text is "." then
    set filestatus to my checkifopened(myfile, 60)
    if filestatus = false then
    display dialog "timeout on folder action"
    else
    set tmp to ((characters 1 through -5 of myfilename) & "#" & myfile_datestring & (characters -4 through -1 of myfilename)) as text
    set myfilename to my checknamewith_pdfsuffix(tmp, thefolder, false)
    set name of myfile to myfilename
    end if
    end if
    end repeat
    end tell
    end adding folder items to
    on get_datestring(mydate)
    return year of mydate & "-" & (characters -2 through -1 of (("0" & (month of mydate as integer)) as text)) & "-" & (characters -2 through -1 of (("0" & (day of mydate as integer)) as text)) as text
    end get_datestring
    on checknamewith_pdfsuffix(n, D, looped)
    --check if filename exists in D
    -- so if "A File.pdf" exists it names it "A File 1.pdf","A File 2.pdf",...
    #n = string of the filename
    #D = file reference to the directory to check
    #looped = boolean used for recursive loop...
    tell application "Finder"
    set thefiles to name of every item of (D as alias)
    end tell
    if thefiles contains n then
    if looped = false then
    set n to ((characters 1 through -5 of n) & "(1)" & (characters -4 through -1 of n)) as text
    my checknamewith_pdfsuffix(n, D, true)
    else
    set tmp to (last word of ((characters 1 through -5 of n) as text) as integer)
    set tmpcount to (count of characters of (tmp as text)) + 5
    set tmp to tmp + 1
    set n to ((characters 1 through (-1 * tmpcount) of n) & "(" & tmp & ")" & (characters -4 through -1 of n)) as text
    my checknamewith_pdfsuffix(n, D, true)
    end if
    else
    return n
    end if
    end checknamewith_pdfsuffix
    on checkifopened(this, mytimeout)
    ## this file reference
    ## timeout in seconds
    set a to POSIX path of (this as alias)
    set startdate to current date
    repeat until 1 = 0
    ## don't like that one because it relies on an error msg ... so
    (** try
    set b to do shell script "lsof | grep " & quoted form of a
    on error
    exit repeat
    end try**)
    ##so I use this one
    set b to do shell script "lsof"
    if b does not contain a then
    return true
    else if ((current date) - startdate) > mytimeout then
    return false
    else
    ##say "still opened"
    end if
    end repeat
    end checkifopened
    to use this save this script in /Library/Scripts/Folder Action Scripts
    and add this as a folder action to your folder...
    The script processes all files inside that folder each time a new files is added...

  • Need immediately script for Restore Datafiles from TAPE  Please.

    Hi All,
    Could you please provide me the script to restore 10 datafiles using RMAN which are stored on tape.

    Hi!
    1. Restore the whole database:
    run {
    allocate channel t1 type "sbt_tape" parms 'ENV=(TDPO_OPTFILE=/path/to/your/client/tdpo_file)';
    restore database;
    release channel t1;
    2. Restore a tablespace: (In the Example the USERS tablespace will be restored)
    run {
    allocate channel t1 type "sbt_tape" parms 'ENV=(TDPO_OPTFILE=/path/to/your/client/tdpo_file)';
    restore tablespace users;
    release channel t1;
    3. Restore a datafile: (In the example teh datafile number 5 will be restored)
    run {
    allocate channel t1 type "sbt_tape" parms 'ENV=(TDPO_OPTFILE=/path/to/your/client/tdpo_file)';
    restore datafile 5;
    release channel t1;
    In the above examples:
    - you need to change the location of your TDPO config file.
    - the database/tablespace/datafile will be only restored and not will be recovered
    Best Regards
    Norbert

  • Script for Users, Roles,Grant,Tablespace

    Hi,
    Please guide me on the following .
    I am moving database to new Unix server .
    so can I create the script which will check the existing Users, Roles, Grants, Tablespaces from current database and store that data.
    And using same soared data I want to create the same " Users, Roles, Grants, Tablespaces" using the script.
    Can i do this. Please guide me how to do this so I will help me to move database
    Thanks,
    Amol

    You should run ?\rdbms\admin\utlrp (note the ?, which is shorthand for ORACLE_HOME) from the database server. to make sure you have the correct script. You can call sqlplus from Toad easily.
    The script affects PL/SQL only. PL/SQL resides in the SYSTEM tablespace in the SYS schema. You don't have 400G of PL/SQL. It should take a few minutes only.
    The SYSTEM schema WILL be imported. SYS will not be imported, but automagically recreated. The only thing you will miss is Grants which have been made by SYS directly to end-users or roles, outside those defined in catalog.sql
    Sybrand Bakker
    Senior Oracle DBA

  • Script for adding layer name to artboard as text

    I've found scripts that are sort of close but not quite this.
    I have 1 artboard and many layers (see image).
    Does anyone have a script that will take the name of the layer, ie "01_Intro" and create and then place the text "01_Intro" on to the art board in layer 01_Intro? Then it would repeat the process for all the present layers?
    Thanks in advance!

    Waterbear,
    something like this?
    // LayersnamesInUpperLeftCorner.jsx
    // https://forums.adobe.com/thread/1546630
    // write layers names in upper left corner of the active artboard
    // required: opened document, no toplevel layers locked, all layers visible
    // regards pixxxelschubser
    var aDoc = app.activeDocument;
    var theLayers = aDoc.layers;
    for (i=0; i<theLayers.length; i++) {
        var txt = theLayers[i].textFrames.add();
        txt.position = [0,0];
        txt.contents = theLayers[i].name;
    Have fun

  • A script for adding Tags based on search result

    Hello all fellow faithfuls of InDesign!
    I am looking at a challenge with my very basic (near to none) experience of scripting, that goes like this:
    I need a script that could search through my story/selection and look for patterns (such as four digits in a row, basic RegEx stuff) and add a specific Tag-element with some specific attributes and given values that would be taken from the found pattern.
    EXAMPLE: (Searching the text below)
    Product 7352     price 23,60
    Now the script would find: 7352 and tag it [7352] and give it attributes like RecordID = 7352 and Field = PRODUCTNR
    For the price it would find the 23,60 and give it the same RecordID = 7352 and Field = PRICE.
    How would I approach something like this?

    Hi AshishK15,
    Base on your code, I think the exception is threw in the code of Selection.Paragraphs(i).Range.Select.
    For your code, you are getting the all paragraphs of the document (iParCount), however you are using the Selection object to get all paragraphs, which is incorrect unless you select the whole document content.
    So, please modify the Selection to ActiveDocument.
    For i = 1 To iParCount
    ActiveDocument.Paragraphs(i).Range.Select
    If ActiveDocument.Paragraphs(i).Range.ListParagraphs.Count = 1 Then
    MsgBox ActiveDocument.Paragraphs(i).Range.ListFormat.ListLevelNumber
    MsgBox ActiveDocument.Paragraphs(i).OutlineLevel
    End If
    Next
    Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • HT1347 Windows: Is there a script for adding a folder to an iTunes Library at startup?

    Has anyone ever created a script to have "watched folders" functionality in iTunes?
    Three out of the four users in my household share the same iTunes library folder, which resides on a separate hard drive (along with the iTunes Library of the 4th user). I thought this would be the easiest way for all the music purchased for our family to be shared among us, while not sharing playlists. I thought iTunes would, automatically and routinely, scan and categorize the files in the designated iTunes Media Folder.
    However, now whenever someone adds music through their account, the songs will not show up in another user's library (even though both accounts use the same iTunes Media Folder). The only way to have an up-to-date library, is to go to "File" > "Add Folder to Library..." and add the iTunes Media folder each time a user starts their iTunes instance.
    I'm new to iTunes (moving over from WMP and VLC).
    Just in case anyone cares... I'm using:
    - iTunes 10.7.0.21
    - Windows 7 Home Premium 64-bit (with Service Pack 1)
    - We have an iPhone and an iPod touch in the household

    iTunes Folder Watch
    tt2

  • How to write a script for adding a percentage?

    I have a simple form where I need a cell to automattically add a percentage to a different cell.
    For example in Excel my expression is: =SUM(E9*0.014)  [90*1.4%= 1.26] where as Cell E9 will be the amount I need the percentage to added to. 
    Header 1
    Header 2
    Number
    Surcharge
    90
    =sum(90*.014)
    Thanks,

    Moving this discussion to the Javascript since USA Fire's other inquiry was located in this forum.

  • Poweshell script for adding the computer object in to SCOM 2012 group.

    Hi Team,
    Is there any way to add the computer object ( csv file) to SCOM 2012 manually created  group.

    Hi,
    In addition, hope the links below be helpful for you:
    Creating and Updating Groups
    http://blogs.msdn.com/b/jakuboleksy/archive/2006/11/15/creating-and-updating-groups.aspx
    Programmatically Creating Groups
    http://blogs.technet.com/b/brianwren/archive/2008/11/18/programmatically-creating-groups.aspx
    Modifying Explicit Group Membership in SCOM 2012 with PowerShell
    http://blogs.msdn.com/b/rslaten/archive/2013/06/27/modifying-explicit-group-membership-in-scom-2012-with-powershell.aspx
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Script for adding zones on cisco9506

    Hello,
    I have some 50 zones to add to a zoneset.. is there any easy way like a script to use  and push it..

    Hello,
    Please use this
    Automatic Zone Set Distribution
    To enable the switch to distribute the local zone set to all other switches in the VSAN when a zone set is activated, use the zone set distribute full vsan 804 command:
    ca-9506# conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    ca-9506(config)# zoneset distribute full vsan 804
    also refer
    http://www.cisco.com/en/US/docs/storage/san_switches/mds9000/sw/rel_1_x/1_3/cookbook/CB_zone.html

  • Script for adding a page

    Is there a way to have a whole page invisible from the actual form but when a certain word is selected from a drop down list the page then appears?? Thanks.

    I figured out how to do this one...pretty easy actually.
    on exit use addInstance and removeInstance

Maybe you are looking for

  • Easiest way to update all apps on iPhone 5S without having to click update for each one under the apps tab in iTunes

    After I've used the download all updates option under the updates tab in the iTunes library Apps view, when I plug in my device (iPad or iPhone) and go to the device apps view I now have a button to the right of each of those apps that says "update"

  • External Hard Drive and USB Hubs

    I need some help. I have a 320GB External Hard Drive which uses 2 USB Ports. I also have an external keyboard and mouse, using USB. I first purchased a 'passive' USB hub and the Mac was unable to recognize the External Hard Drive. So, I purchased a U

  • Supportpack -  SRM 7.0 SP10

    Hi all,    We are currently in SRM 7.0 SP08, planning to apply SP10. Is there anyone who is already in SRM 7.0 SP10. Would like to know how stable it is compared to SP09. Did you face any major setbacks or issues while moving to SP10. Would appreciat

  • Hi, i cannot open PDF files.  I recently downloaded a sample of Adobe Pro, but that has now expired

    Hi, i cannot open PDF files.  I recently downloaded a sample of Adobe Pro, but that has now expired and my PC wants a code input to enable me to open adobe files. I do not wish to purchase Adobe Pro as it is too expensive. please help, being unable t

  • I made a new apple ID

    I couldnt access my email to the other apple ID I had, so I made a new one. I deleted my iCloud with the old email I had and now I'm trying to log in with my new apple ID and everytime I try it says "Cannot sign in. The operation couldnt be completed