Reset the sequence

Hi,
I have a set of statements in the procedure as below :
This is a daily job. we are planning to reset the Sequence on daily basis.
Is there any other way instead of resetting the sequence?  We are resetting because todays number may come tomorw also.
select SEQ_NAME.nextval into No_Col from dual;
insert into table
    (No,NoDAYWISE,Method)
    values ( No_Col, to_char(sysdate, 'DD') || to_char(sysdate, 'MM') ||
           to_char(sysdate, 'YY') || No_Col, 10)
This is the table structure
No
NoDAYWISE
Method
181
300813181
421
161
160813161
421
201
160913201
421
Thanks in advance.

I agree with Paul's comment. Sequences are meant to generate unique numbers.
If you are bend to implement this, below script might help you:
drop sequence test_seq;
create sequence test_seq start with 1 nocycle nocache;
select test_seq.nextval from dual;
select test_seq.nextval from dual;
select test_seq.nextval from dual;
select test_seq.nextval from dual;
select test_seq.nextval from dual;
set serveroutput on;
declare
  v_num number;
begin
  select 1 - test_seq.nextval into v_num from dual;
  dbms_output.put_line('Before reset Seq val :: ' || v_num);
  execute immediate 'alter sequence test_seq increment by ' || v_num;
  select test_seq.nextval into v_num from dual;
  dbms_output.put_line('After reset Seq val ::' || v_num);
  execute immediate 'alter sequence test_seq increment by 1';
end;
An easier way to achieve is, drop the sequence and create it again; this and even the above, I do not recommend.

Similar Messages

  • Resetting the Sequence operator in OWB

    I have a Sequence operator for one column in the mapping. It correctly increments by 1 for each row (nextval) . I have done some testing and now I want to reset the next increments. Like I want to start from 1 instead of some 588 like that which is result of my testing.
    How to reset the sequence operator so that it starts from 1 again.
    Thanks

    Hi Tom,
    First you should create a store procedure that resets the last_number of a specified sequence w/ parameters sequence_name and start value. Then just call the stored proc from OWB to reset your sequence.
    --stored proc ex:
    create or replace PROCEDURE reset_sequence (
    seq_name IN VARCHAR2, startvalue IN PLS_INTEGER) AS
    cval INTEGER;
    inc_by VARCHAR2(25);
    BEGIN
    EXECUTE IMMEDIATE 'ALTER SEQUENCE ' ||seq_name||' MINVALUE 0';
    EXECUTE IMMEDIATE 'SELECT ' ||seq_name ||'.NEXTVAL FROM dual'
    INTO cval;
    cval := cval - startvalue + 1;
    IF cval < 0 THEN
    inc_by := ' INCREMENT BY ';
    cval:= ABS(cval);
    ELSE
    inc_by := ' INCREMENT BY -';
    END IF;
    EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seq_name || inc_by ||
    cval;
    EXECUTE IMMEDIATE 'SELECT ' ||seq_name ||'.NEXTVAL FROM dual'
    INTO cval;
    EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seq_name ||
    ' INCREMENT BY 1';
    END reset_sequence;
    --calling stored proc ex:
    --sequence name is employees_seq; reset value to 1
    DECLARE
    SEQ_NAME VARCHAR2(200);
    STARTVALUE PLS_INTEGER;
    BEGIN
    SEQ_NAME := 'EMPLOYEES_SEQ';
    STARTVALUE := 1;
    RESET_SEQUENCE(
    SEQ_NAME => SEQ_NAME,
    STARTVALUE => STARTVALUE
    END;
    Hope it works! Cheers!=)
    Regards,
    Carlo

  • How to insert a record & reset the sequence for all record

    Hi All,
    I am using Oracle Form 6i. In one of my forms,
    I need to delete all records id and reset the ids in a sequence when i do a new insert
    id value
    1 x
    2 y
    3 z
    when i insert a record 4 between 2 & 3 records with value 'A'
    id value
    1 x
    2 y
    3 z
    4 A
    what i need to modify
    id value
    4 x
    5 y
    6 A
    7 z
    i tried pre-insert trigger by going to first record & looping . no luck.
    Could anyone suggest me.
    thanks
    Red
    Edited by: Red on Sep 15, 2008 7:11 AM

    Would it not be fine if you ensure that all your commit actions are coded as,
    Do_Key ('COMMIT_FORM') correction: In regards to u3's response
    You would also have to override relevant key trigger behavior to check for form changes.
    KEY-ENTQUERY, KEY-EXECQUERY, ....
    If your form is a master detail form, On-Clear-Details (This is a tricky one to maintain :-))
    Edited by: easot on Sep 16, 2008 6:32 PM
    correction

  • Reset a sequence

    Hi,
    This is the requirement. WE have a code which creates an outbound file containing the posted journal entries. These are named in a way that there is a sequence at the end of the name.
    We need to reset the sequence used in that code every month so that it starts from one at the beg. of the month.
    Any help is appreciated.
    Thanks,
    Ash

    possible solutions:
    1. create a procedure that drop and create the sequence dynamically
           create or replace procedure prc_recreate_sequence(pSeqName varchar2, pStartNum Number, pIncrementNum Number) as
           begin
              execute immediate 'Drop Sequence '||pSeqName;
              execute immediate 'Create Sequence '||pSeqName||' Start With '||pStartNum||' Increment By '||pIncrementNum;
           end;
           /2. create a table that logs the current value as a sequence bypassing the use of the actual sequence
           create table sequence_log
             (sequence_name  varchar2(40),
              start_with     number,
              increment_by   number,
              current_val    number);
           insert into sequence_log
           values ('trans_dtl_seq',1,1,1);in your code call this table to utilize it
           declare
             vSeqNum     number := 0;
           begin
             select (current_val)+1
               into vSeqNum
               from sequence_log
              where sequence_name = 'trans_dtl_seq';
             update sequence_log
                set current_val = vSeqNum
              where sequence_name = 'trans_dtl_seq';
            end;

  • I don't remember the sequence to reset the software.

    Printer started hanging up mid printing.  I calcell the print and it gives an error msg re inproper shut down.  It was not shut down.  After a bit it will start printing the canceled document.  This has been an issue free workhorse for us and I would hate to loose it now.  Ti that end I thought I would do the reset procedure but don't recall how.  As near as I can recall there were several keys to hold down while turning the power on.

    Hi @KIGER,
    Welcome to the HP Forums!
    I understand you are trying to reset the software for your HP Photosmart 3210xi printer. I am happy to help!
    If you are trying to reset the printer itself, I would start with a Hard Reset, by following this post, How to perform a Hard Reset, by @Rich1. It is important to make sure that the printer's power cable is plugged directly into the wall and not a surge protector! Issues when Connected to an Uninterruptible Power Supply/Power Strip/Surge Protector. This applies to Inkjet printers as well. 
    If you mean the software on the computer then try the following:
    Uninstall the software. Uninstalling the Printer Software.
    Clean boot the computer. How to perform a clean boot in Windows.
    Disable any Antivirus programs. Disable Antivirus software.
    Disable any firewall programs. Turn Windows Firewall on or off.
    Create a new user account. Managing User Accounts and Logins (Windows 7).
    Reinstall using the HP Printer Install Wizard for Windows.
    Hope this is what you're looking for, and have a good day!
    RnRMusicMan
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to say “Thanks” for helping!

  • My husband plugged in a password and we don't know what it is and cannot log onto the new computer.  How can I reset the password if I can't log on?

    My husband was setting up the iMac he got us for Christmas.  I already have a MacBook Pro.  I do not know the sequence of events but I do know he wanted to use my iTunes account on the iMac so I provided passwords.  Now we cannot log onto the computer using any of my passwords.  He must have mistyped something.  How do we log onto the computer if we can't figure out what the password is?

    If it's a new Mac I guess it's running Lion, if so, hopefully this'll help:
    http://osxdaily.com/2011/08/24/reset-mac-os-x-10-7-lion-password/

  • How do I reset the PRAM of my MacBook Pro in OSX Mountain Lion?

    Dear all, I bought a new MacBook Pro 13" (Mid 2012, MacBook Pro 9,2) and upgraded the OS to Mountain Lion. There have been some crashes (apparently related do Chrome), so I wanted to reset the PRAM to "clean up" a bit, but it didn't work. I made sure I followed the standard procedure (as in my old MacBook Pro 15" Late 2008, which was stolen), and held properly the CMD+OPT+P+R combination before getting the grey screen. Just to be sure, I tried shutting down and turning on again and also just restarting my Mac. Neither worked. What may be the problem? Thanks.

    The fact that Apple saw fit to put out a ML-specific PRAM-reset note confirms that the key sequence is unchanged. Yet I've witnessed quite a few instances of people complaining that it did not work on that OS. Will try when I get on my testbench later tonight. But still seems odd to have such a recurrence of the same complaint.

  • Understanding the sequence choices

    Okay I figured out how I'm gonna name my images. But now I'm trying to understand these sequence choices which are:
    1. Sequence # (1).
    2. Sequence # (01).
    3. Sequence # (001).
    4. Sequence # (0001).
    5. Sequence # (000001).
    Do these options correspond to how many files Lightroom will number up to? Like say I chose Sequence # (1). If I had only nine photos I would be okay since Lightroom will number them from 1 to 9. But as I add image number ten then I'm in trouble cuz I've run out of digits?
    So basically if you choose # (1) you can have up to 9 images (ten if you start numbering at 0) before running out of numbers.
    If you choose # (01) you can have up to 99 images before you start running out of numbers.
    If you choose # (001) you can have up 999 images before you start running out of numbers.
    Am I understanding this correctly?

    No, this is not how it works. The format specifies how many leading zeroes will be added to the number if the number itself does not occupy all the digits.
    Examples:
    Image #
    #(1)
    #(01)
    #(001)
    #(0001)
    1
    1
    01
    001
    0001
    2
    2
    02
    002
    0002
    9
    9
    09
    009
    0009
    10
    10
    10
    010
    0010
    11
    11
    11
    011
    0011
    99
    99
    99
    099
    0099
    100
    100
    100
    100
    0100
    999
    999
    999
    999
    0999
    1000
    1000
    1000
    1000
    1000
    The Sequence Number refers to the number of images within a single import, which means it will be reset with each new import.
    Beat

  • Is it possible to rename photo in the "camera roll" OR reset the photo number in iphone 4s? (Clearly explained the situation)

    Hi everyone, nice to meet you all. This is my first discussion starting in here and nice to meet you all. I used Android device before and this is my first apple mobile that I owned. I am using iphone 4s. (5.0.1)
    I have search a lot but no answer that how can I rename the photo in the camera roll in iphone or in Windows 7.
    What I want to do is:
    I have IMG_0006, IMG_0007, IMG_0015, IMG_0016, IMG_0017, total 5 files.
    I want to change the name that make their sequence will become IMG_0001, IMG_0002, IMG_0003, IMG_0004, IMG_0005 and I want the following picture will take place in IMG_0006. (This is just what I want but it never happened)
    but seems that I can't rename them and I have tried that if I take 2 pictures after IMG_0017, but I delete them (which is delete IMG_0018 and IMG_0019), then take another new picture again, it will name as IMG_0020 instead of IMG_0018.
    Questions:
    1. Are there any methods to reset the photo number by deleting file under the "PhotoData" that we can see in iPhone Explorer?
    OR
    2. Are there any methods to rename the photo in the "camera roll" folder?
    I have tried to rename the photo directly in iPhone Explorer but it will make the photo cannot be read in iphone.
    3. Is it possible that I can rename them directly and rebuild the camera roll by deleting the Photos.sqlite under the PhotoData folder to solve the unreadable problem in iphone 4?
    Thanks a lot to read all of the words above

    Thanks for your quick reply. I think I have tried but I cannot.
    There are no any options to let you choose "rename" in Windows 7 if you connect the iphone via USB
    I have tried to rename the photo directly in iPhone Explorer but it will make the photo cannot be read in iphone and just got nothing to show on its screen until I rename it into the previos name again then the picture will show properly.
    May be it can but I do not know how to rename them in Windows 7, could you please show me step by step?

  • How can I reset the value of an array?

    How can I reset the value of an array at the beginning of my program?

    There is a option in LV,
    "Edit --> Make current value defult"
    Every time you reopen your VI, it will set to your custom default value.
    There are many ways of doing this.
    Another way of doing this is, You can use "sequence structure and property node". Make the property node of your array and choose "value". Then mark it to write. See attach.
    When you feel sad, laugh
    Attachments:
    x.GIF ‏4 KB

  • Query of the sequence

    Is it possible to change sequence value on monthly basis.
    ex. I want to start sequence from 1to 1000 and then reset from 1 to 1000 after month.
    for every month i want to reset sequence is it possible.
    Thanks in advance

    Hi,
    I agree with Gj. I think you should use dbms_scheduler to do this at the beginning of every month.
    I don't like the idea of dropping and re-creating the sequence. You'll lose grants, and procedures that reference the sequence will become invalid.
    You can't alter the actual value of the sequence, but you can temporarily alter the INCREMENT BY value to get the same result, as shown in the script below:
    PROMPT     ==========  reset_seq procedure  ==========
    CREATE OR REPLACE PROCEDURE     reset_seq
    (     in_seq_name     IN     VARCHAR2     -- Name of sequence to be reset
    ,     in_new_val     IN     NUMBER     := 1     -- Bew value
    AUTHID     CURRENT_USER
    AS
    --     reset_seq changes the value of the given sequence.
    --     This assumes:
    --       (a) no one else will use the sequence while this is running
    --       (b) the INCREMENT BY value of the sequence is 1
    --       (c) the MINVALUE value of the sequence is less than in_new_val
    --     A little extra coding can fix (b) and (c)
         current_val     PLS_INTEGER;
         get_txt     VARCHAR2 (1000)     := 'SELECT ' || in_seq_name || '.NEXTVAL'
                        || '     FROM dual';
         set_txt VARCHAR2 (1000)     := 'ALTER SEQUENCE ' || in_seq_name
                        || '     INCREMENT BY ';
    BEGIN
         EXECUTE IMMEDIATE get_txt INTO current_val;
         EXECUTE IMMEDIATE set_txt || TO_CHAR (FLOOR ((in_new_val - 1) - current_val));
         EXECUTE IMMEDIATE get_txt INTO current_val;
         EXECUTE IMMEDIATE set_txt || '1';
    END     reset_seq
    SHOW ERRORS
    PROMPT     ==========  Creating sequence  ==========
    DROP SEQUENCE     x_seq;
    CREATE SEQUENCE     x_seq
    MINVALUE     0
    NOCACHE
    START WITH     1;
    PROMPT     ==========  Using some values  ==========
    SELECT     x_seq.NEXTVAL
    FROM     dual
    CONNECT BY     LEVEL     <= 5;
    PROMPT     ==========  Re-setting sequence  ==========
    EXECUTE     reset_seq ('x_seq');
    SELECT     x_seq.NEXTVAL     AS new_improved
    FROM     dual;The first two steps (creating the reset_seq procedure and creating the sequence) are done once, for all time.
    The next step "using some value" simulates your normal work during the month.
    At the beginning of every month, call reset_seq, as shown.

  • How to reset all sequence to 0 or 1 at time?

    Friends,
    OS: RHEL AS 3
    DB: 9iR2
    I have some 187 sequences. i want to reset all the sequences to "0" or "1" at a time.
    how can i do that?
    i its a single sequence, then i will do the below...
    for example if i have the x.nextval is 4
    alter sequence x increment by -4;
    alter sequence x increment by 1;
    the above is only for x but i have x,y,z,.......upto 187 sequences...
    how can i do that?
    any triggers or procedures? or any quick method.
    thanks

    A similar situation: there are tables having a group_column with group_column_values having each it's own sequence to feed a sequence_column
    Adding data requires the sequences to be reset to new maximum values (it's our development environment not production)
    procedure reset_sequences(p_table_name in varchar2) is
    /* sequence names are like: table_name || '_' || to_char(group_column_value)
      name_for_sequence varchar2(30) := upper(substr(p_table_name,instr(p_table_name,'.') + 1)) || '_';
      sql_for_sequence_max varchar2(250) := 'select group_column,max(sequence_column) the_max from ' || p_table || ' group by group_column';
      the_result sys_refcursor;
      local_group number;
      local_max number;
    begin
      for the_row in (select sequence_name
                        from user_sequences
                       where sequence_name like name_for_sequence || '%')
        loop
          execute immediate 'drop sequence ' || the_row.sequence_name;
        end loop;
      open the_result for sql_for_sequence_max;
      loop
        fetch the_result into local_group,local_max;
        exit when the_result%notfound;
        execute immediate 'create sequence ' || name_for_sequence || to_char(local_group) ||
                          ' start with ' || to_char(local_max + 1) || ' nocache';
      end loop;
      close the_result;
    end reset_sequences;Regards
    Etbin

  • How do  you reset the root password in Mountain Lion?

    After install of Mountain Lion on my old iMac, I could not enter administrator, no password would work, Apple support helped me go through terminal to reset root password and root as administrator . I then was able to reset myself as administrator with a new pasword. I used that paassword a few times now it wont accept it again. I dont remember all the steps to reset the root password and recover from this situation.. Can anyone help?  Is this a bug in Mountain Lion?

    I'm having similar issues but other concerns
    1. Can't go into recovery mode since its protected by firmware password, which I don't have. All option keys sequences go into the same firmware padlock, which I don't have the apparent pin.
    2. In terminal mode it didn't happen to recognize that unix command.  Also since I'm just on guest would that reset for the admin or possibly the guest acct?
    3. I've done the DIMM pulls and even though older model, 2011, it didn't appear to a reset for the firmware password.
    Any other options??

  • I was rubbing my keys and screwed up my font setting. i don't know how to reset the font to original mozilla setting

    i was rubbing my laptop keys. i must have hit the right key sequence to change the font setting. i don't know how to reset the font. i was in mozilla at the time, so only it was affected. IE still uses the correct webpage fonts. IE has a reset on their browser, does firefox?

    Have you tried closing Firefox and visiting the site again without restoring your session? This will bypass any temporary changes.
    If the problem is the font size, you can reset the zoom level:
    View menu > Zoom > Reset
    If you have the orange Firefox button, tap the Alt key or press F10 to display the classic menu bar where you will find the View menu.
    If that doesn't help, can you describe what's different in more detail?

  • My older iMac running Mavericks 10.9.4 shuts down when it connects to the internet.  Resetting the SMC doesn't help.  What can I do?

    My older iMac running Mavericks 10.9.4 shuts down when it connects to the internet.  Resetting the SMC doesn't help.  What can I do?

    1. This procedure is a diagnostic test. It changes nothing, for better or worse, and therefore will not, in itself, solve the problem. But with the aid of the test results, the solution may take a few minutes, instead of hours or days.
    Don't be put off merely by the seeming complexity of these instructions. The process is much less complicated than the description. You do harder tasks with the computer all the time.
    2. If you don't already have a current backup, back up all data before doing anything else. The backup is necessary on general principle, not because of anything in the test procedure. Backup is always a must, and when you're having any kind of trouble with the computer, you may be at higher than usual risk of losing data, whether you follow these instructions or not.
    There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    3. Below are instructions to run a UNIX shell script, a type of program. As I wrote above, it changes nothing. It doesn't send or receive any data on the network. All it does is to generate a human-readable report on the state of the computer. That report goes nowhere unless you choose to share it. If you prefer, you can read it yourself without disclosing the contents to me or anyone else.
    You should be wondering whether you can believe me, and whether it's safe to run a program at the behest of a stranger. In general, no, it's not safe and I don't encourage it.
    In this case, however, there are a couple of ways for you to decide whether the program is safe without having to trust me. First, you can read it. Unlike an application that you download and click to run, it's transparent, so anyone with the necessary skill can verify what it does.
    You may not be able to understand the script yourself. But variations of the script have been posted on this website thousands of times over a period of years. The site is hosted by Apple, which does not allow it to be used to distribute harmful software. Any one of the millions of registered users could have read the script and raised the alarm if it was harmful. Then I would not be here now and you would not be reading this message.
    Nevertheless, if you can't satisfy yourself that these instructions are safe, don't follow them. Ask for other options.
    4. Here's a summary of what you need to do, if you choose to proceed:
    ☞ Copy a line of text in this window to the Clipboard.
    ☞ Paste into the window of another application.
    ☞ Wait for the test to run. It usually takes a few minutes.
    ☞ Paste the results, which will have been copied automatically, back into a reply on this page.
    The sequence is: copy, paste, wait, paste again. You don't need to copy a second time. Details follow.
    5. You may have started the computer in "safe" mode. Preferably, these steps should be taken in “normal” mode, under the conditions in which the problem is reproduced. If the system is now in safe mode and works well enough in normal mode to run the test, restart as usual. If you can only test in safe mode, do that.
    6. If you have more than one user, and the one affected by the problem is not an administrator, then please run the test twice: once while logged in as the affected user, and once as an administrator. The results may be different. The user that is created automatically on a new computer when you start it for the first time is an administrator. If you can't log in as an administrator, test as the affected user. Most personal Macs have only one user, and in that case this section doesn’t apply. Don't log in as root.
    7. The script is a single long line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, though you may not see all of it in the browser window, and you can then copy it. If you try to select the line by dragging across the part you can see, you won't get all of it.
    Triple-click anywhere in the line of text below on this page to select it:
    PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/libexec;clear;cd;p=(Software Hardware Memory Diagnostics Power FireWire Thunderbolt USB Fonts SerialATA 4 1000 25 5120 KiB/s 1024 85 \\b%% 20480 1 MB/s 25000 ports ' com.clark.\* \*dropbox \*GoogleDr\* \*k.AutoCAD\* \*k.Maya\* vidinst\* ' DYLD_INSERT_LIBRARIES\ DYLD_LIBRARY_PATH -86 ` route -n get default|awk '/e:/{print $2}' ` 25 N\\/A down up 102400 25600 recvfrom sendto CFBundleIdentifier 25 25 25 1000 MB com.apple.AirPortBaseStationAgent 464843899 51 );N5=${#p[@]};p[N5]=` networksetup -listnetworkserviceorder|awk ' NR>1 { sub(/^\([0-9]+\) /,"");n=$0;getline;} $NF=="'${p[26]}')" { sub(/.$/,"",$NF);print n;exit;} ' `;f=('\n%s: %s\n' '\n%s\n\n%s\n' '\nRAM details\n%s\n' %s\ %s '%s\n-\t%s\n' );S0() { echo ' { q=$NF+0;$NF="";u=$(NF-1);$(NF-1)="";gsub(/^ +| +$/,"");if(q>='${p[$1]}') printf("%s (UID %s) is using %s '${p[$2]}'",$0,u,q);} ';};s=(' /^ *$|CSConfigDot/d;s/^ */   /;s/[-0-9A-Fa-f]{22,}/UUID/g;s/(ochat)\.[^.]+(\..+)/\1\2/;/Shared/!s/\/Users\/[^/]+/~/g ' ' s/^ +//;5p;6p;8p;12p;' ' {sub(/^ +/,"")};NR==6;NR==13&&$2<'${p[10]} ' 1s/://;3,6d;/[my].+:/d;s/^ {4}//;H;${ g;s/\n$//;/s: [^EO]|x([^08]|02[^F]|8[^0])/p;} ' ' 5h;6{ H;g;/P/!p;} ' ' ($1~/^Cy/&&$3>'${p[11]}')||($1~/^Cond/&&$2!~/^N/) ' ' /:$/{ N;/:.+:/d;s/ *://;b0'$'\n'' };/^ *(V.+ [0N]|Man).+ /{ s/ 0x.... //;s/[()]//g;s/(.+: )(.+)/ (\2)/;H;};$b0'$'\n'' d;:0'$'\n'' x;s/\n\n//;/Apple[ ,]|Intel|SMSC/d;s/\n.*//;/\)$/p;' ' s/^.*C/C/;H;${ g;/No th|pms/!p;} ' '/= [^GO]/p' '{$1=""};1' ' /Of/!{ s/^.+is |\.//g;p;} ' ' $0&&!/ / { n++;print;} END { if(n<200) print "com.apple.";} ' ' $3~/[0-9]:[0-9]{2}$/ { gsub(/:[0-9:a-f]{14}/,"");} { print|"tail -n'${p[12]}'";} ' ' NR==2&&$4<='${p[13]}' { print $4;} ' ' END { $2/=256;if($2>='${p[15]}') print int($2) } ' ' NR!=13{next};{sub(/[+-]$/,"",$NF)};'"`S0 21 22`" 'NR!=2{next}'"`S0 37 17`" ' NR!=5||$8!~/[RW]/{next};{ $(NF-1)=$1;$NF=int($NF/10000000);for(i=1;i<=3;i++){$i="";$(NF-1-i)="";};};'"`S0 19 20`" 's:^:/:p' '/\.kext\/(Contents\/)?Info\.plist$/p' 's/^.{52}(.+) <.+/\1/p' ' /Launch[AD].+\.plist$/ { n++;print;} END { print "'${p[41]}'";if(n<200) print "/System/";} ' '/\.xpc\/(Contents\/)?Info\.plist$/p' ' NR>1&&!/0x|\.[0-9]+$|com\.apple\.launchctl\.(Aqua|Background|System)$|'${p[41]}'/ { print $3;} ' ' /\.(framew|lproj)|\):/d;/plist:|:.+(Mach|scrip)/s/:[^:]+//p ' '/^root$/p' ' !/\/Contents\/.+\/Contents|Applic|Autom|Frameworks/&&/Lib.+\/Info.plist$/ { n++;print;} END { if(n<1100) print "/System/";} ' '/^\/usr\/lib\/.+dylib$/p' ' /Temp|emac/ { next;} /(etc|Preferences|Launch[AD].+)\// { sub(".(/private)?","");n++;print;} END { print "'${p[41]}'.plist\t'${p[42]}'";if(n<500) print "Launch";} ' ' /\/(Contents\/.+\/Contents|Frameworks)\/|\.wdgt\/.+\.([bw]|plu)/d;p;' 's/\/(Contents\/)?Info.plist$//;p' ' { gsub("^| |\n","\\|\\|kMDItem'${p[35]}'=");sub("^...."," ") };1 ' p '{print $3"\t"$1}' 's/\'$'\t''.+//p' 's/1/On/p' '/Prox.+: [^0]/p' '$2>'${p[43]}'{$2=$2-1;print}' ' BEGIN { i="'${p[26]}'";M1='${p[16]}';M2='${p[18]}';M3='${p[31]}';M4='${p[32]}';} !/^A/ { next;} /%/ { getline;if($5<M1) a="user "$2"%, system "$4"%";} /disk0/&&$4>M2 { b=$3" ops/s, "$4" blocks/s";} $2==i { if(c) { d=$3+$4+$5+$6;next;};if($4>M3||$6>M4) c=int($4/1024)" in, "int($6/1024)" out";} END { if(a) print "CPU: "a;if(b) print "I/O: "b;if(c) print "Net: "c" (KiB/s)";if(d) print "Net errors: "d" packets/s";} ' ' /r\[0\] /&&$NF!~/^1(0|72\.(1[6-9]|2[0-9]|3[0-1])|92\.168)\./ { print $NF;exit;} ' ' !/^T/ { printf "(static)";exit;} ' '/apsd|BKAg|OpenD/!s/:.+//p' ' (/k:/&&$3!~/(255\.){3}0/ )||(/v6:/&&$2!~/A/ ) ' ' $1~"lR"&&$2<='${p[25]}';$1~"li"&&$3!~"wpa2";' ' BEGIN { FS=":";} { n=split($3,a,".");sub(/_2[01].+/,"",$3);print $2" "$3" "a[n]" "$1;b=b$1;} END { if(b) print("\n\t* Code injection");} ' ' NR!=4{next} {$NF/=10240} '"`S0 27 14`" ' END { if($3~/[0-9]/)print$3;} ' ' BEGIN { L='${p[36]}';} !/^[[:space:]]*(#.*)?$/ { l++;if(l<=L) f=f"\n   "$0;} END { F=FILENAME;if(!F) exit;if(!f) f="\n   [N/A]";"file -b "F|getline T;if(T!~/^(AS.+ (En.+ )?text$|POSIX sh.+ text ex)/) F=F" ("T")";printf("\nContents of %s\n%s\n",F,f);if(l>L) printf("\n   ...and %s more line(s)\n",l-L);} ' ' /^ +[NP].+ =/h;/^( +D.+[{]|[}])/{ g;s/.+= //p;};' 's/0/Off/p' ' END{print NR} ' ' /id: N|te: Y/{i++} END{print i} ' ' / / { print "'"${p[28]}"'";exit;};1;' '/ en/!s/\.//p' ' NR!=13{next};{sub(/[+-M]$/,"",$NF)};'"`S0 39 40`" ' $10~/\(L/&&$9!~"localhost" { sub(/.+:/,"",$9);print $1": "$9;} ' '/^ +r/s/.+"(.+)".+/\1/p' 's/(.+\.wdgt)\/(Contents\/)?Info\.plist$/\1/p' 's/^.+\/(.+)\.wdgt$/\1/p' ' /l: /{ /DVD/d;s/.+: //;b0'$'\n'' };/s: /{ /V/d;s/^ */- /;H;};$b0'$'\n'' d;:0'$'\n'' x;/APPLE [^:]+$/d;p;' ' /^find: /d;p;' );c1=(system_profiler pmset\ -g nvram fdesetup find syslog df vm_stat sar ps sudo\ crontab sudo\ iotop top pkgutil 'PlistBuddy 2>&1 -c "Print' whoami cksum kextstat launchctl sudo\ launchctl crontab 'sudo defaults read' stat lsbom mdfind ' for i in ${p[24]};do ${c1[18]} ${c2[27]} $i;done;' defaults\ read scutil sudo\ dtrace sudo\ profiles sed\ -En awk /S*/*/P*/*/*/C*/*/airport networksetup mdutil sudo\ lsof test );c2=(com.apple.loginwindow\ LoginHook '" /L*/P*/loginw*' '" L*/P*/*loginit*' 'L*/Ca*/com.ap*.Saf*/E*/* -d 1 -name In*t -exec '"${c1[14]}"' :CFBundleDisplayName" {} \;|sort|uniq' '~ $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 \)' '.??* -path .Trash -prune -o -type d -name *.app -print -prune' :${p[35]}\" :Label\" '{/,}L*/{Con,Pref}* -type f ! -size 0 -name *.plist -exec plutil -s {} \;' "-f'%N: %l' Desktop L*/Keyc*" therm sysload boot-args status " -F '\$Time \$Message' -k Sender kernel -k Message Req 'bad |Beac|caug|dead[^bl]|FAIL|fail|GPU |hfs: Ru|inval|jnl:|last value [1-9]|n Cause: -|NVDA\(|pagin|proc: t|Roamed|rror|ssert|Thrott|tim(ed? ?|ing )o|WARN' -k Message Rne 'Goog|ksadm|SMC:' -o -k Sender fseventsd -k Message Req 'SL' " '-du -n DEV -n EDEV 1 10' 'acrx -o comm,ruid,%cpu' '-t1 10 1' '-f -pfc /var/db/r*/com.apple.*.{BS,Bas,Es,J,OSXU,Rem,up}*.bom' '{/,}L*/Lo*/Diag* -type f -regex .\*[cgh] ! -name *ag \( -exec grep -lq "^Thread c" {} \; -exec printf \* \; -o -true \) -execdir stat -f:%Sc:%N -t%F {} \;|sort -t: -k2 |tail -n'${p[38]} '-L {/{S*/,},}L*/Lau* -type f' '-L /{S*/,}L*/StartupItems -type f -exec file {} +' '-L /S*/L*/{C*/Sec*A,E}* {/,}L*/{A*d,Ca*/*/Ex,Compon,Ex,In,iTu,Keyb,Mail/B,P*P,Qu*T,Scripti,Sec,Servi,Spo,Widg}* -type f -name Info.plist' '/usr/lib -type f -name *.dylib' `awk "${s[31]}"<<<${p[23]}` "/e*/{auto,{cron,fs}tab,hosts,{[lp],sy}*.conf,pam.d/*,ssh{,d}_config,*.local} {,/usr/local}/etc/periodic/*/* /L*/P*{,/*}/com.a*.{Bo,sec*.ap}*t /S*/L*/Lau*/*t .launchd.conf" list getenv /Library/Preferences/com.apple.alf\ globalstate --proxy '-n get default' -I --dns -getdnsservers\ "${p[N5]}" -getinfo\ "${p[N5]}" -P -m\ / '' -n1 '-R -l1 -n1 -o prt -stats command,uid,prt' '--regexp --only-files --files com.apple.pkg.*|sort|uniq' -kl -l -s\ / '-R -l1 -n1 -o mem -stats command,uid,mem' -i4TCP:0-1023 com.apple.dashboard\ layer-gadgets '-d /L*/Mana*/$USER&&echo On' '-app Safari WebKitDNSPrefetchingEnabled' );N1=${#c2[@]};for j in {0..9};do c2[N1+j]=SP${p[j]}DataType;done;N2=${#c2[@]};for j in 0 1;do c2[N2+j]="-n ' syscall::'${p[33+j]}':return { @out[execname,uid]=sum(arg0) } tick-10sec { trunc(@out,1);exit(0);} '";done;l=(Restricted\ files Hidden\ apps 'Elapsed time (s)' POST Battery Safari\ extensions Bad\ plists 'High file counts' User Heat System\ load boot\ args FileVault Diagnostic\ reports Log 'Free space (MiB)' 'Swap (MiB)' Activity 'CPU per process' Login\ hook 'I/O per process' Mach\ ports kexts Daemons Agents launchd Startup\ items Admin\ access Root\ access Bundles dylibs Apps Font\ issues Inserted\ dylibs Firewall Proxies DNS TCP/IP Wi-Fi Profiles Root\ crontab User\ crontab 'Global login items' 'User login items' Spotlight Memory Listeners Widgets Parental\ Controls Prefetching SATA );N3=${#l[@]};for i in 0 1 2;do l[N3+i]=${p[5+i]};done;N4=${#l[@]};for j in 0 1;do l[N4+j]="Current ${p[29+j]}stream data";done;A0() { id -G|grep -qw 80;v[1]=$?;((v[1]==0))&&sudo true;v[2]=$?;v[3]=`date +%s`;clear >&-;date '+Start time: %T %D%n';};for i in 0 1;do eval ' A'$((1+i))'() { v=` eval "${c1[$1]} ${c2[$2]}"|'${c1[30+i]}' "${s[$3]}" `;[[ "$v" ]];};A'$((3+i))'() { v=` while read i;do [[ "$i" ]]&&eval "${c1[$1]} ${c2[$2]}" \"$i\"|'${c1[30+i]}' "${s[$3]}";done<<<"${v[$4]}" `;[[ "$v" ]];};A'$((5+i))'() { v=` while read i;do '${c1[30+i]}' "${s[$1]}" "$i";done<<<"${v[$2]}" `;[[ "$v" ]];};';done;A7(){ v=$((`date +%s`-v[3]));};B2(){ v[$1]="$v";};for i in 0 1;do eval ' B'$i'() { v=;((v['$((i+1))']==0))||{ v=No;false;};};B'$((3+i))'() { v[$2]=`'${c1[30+i]}' "${s[$3]}"<<<"${v[$1]}"`;} ';done;B5(){ v[$1]="${v[$1]}"$'\n'"${v[$2]}";};B6() { v=` paste -d: <(printf "${v[$1]}") <(printf "${v[$2]}")|awk -F: ' {printf("'"${f[$3]}"'",$1,$2)} ' `;};B7(){ v=`grep -Fv "${v[$1]}"<<<"$v"`;};C0(){ [[ "$v" ]]&&echo "$v";};C1() { [[ "$v" ]]&&printf "${f[$1]}" "${l[$2]}" "$v";};C2() { v=`echo $v`;[[ "$v" != 0 ]]&&C1 0 $1;};C3() { v=`sed -E "$s"<<<"$v"`&&C1 1 $1;};for i in 1 2;do for j in 2 3;do eval D$i$j'(){ A'$i' $1 $2 $3; C'$j' $4;};';done;done;{ A0;A2 0 $((N1+1)) 2;C0;A1 0 $N1 1;C0;B0;C2 27;B0&&! B1&&C2 28;D12 15 37 25 8;A1 0 $((N1+2)) 3;C0;D13 0 $((N1+3)) 4 3;D23 0 $((N1+4)) 5 4;D13 0 $((N1+9)) 59 50;for i in 0 1 2;do D13 0 $((N1+5+i)) 6 $((N3+i));done;D13 1 10 7 9;D13 1 11 8 10;D22 2 12 9 11;D12 3 13 10 12;D23 4 19 44 13;D23 5 14 12 14;D22 6 36 13 15;D22 7 37 14 16;D23 8 15 38 17;D22 9 16 16 18;B1&&{ D22 11 17 17 20;for i in 0 1;do D22 28 $((N2+i)) 45 $((N4+i));done;};D22 12 44 54 45;D22 12 39 15 21;A1 13 40 18;B2 4;B3 4 0 19;A3 14 6 32 0;B4 0 5 11;A1 17 41 20;B7 5;C3 22;B4 4 6 21;A3 14 7 32 6;B4 0 7 11;B3 4 0 22;A3 14 6 32 0;B4 0 8 11;B5 7 8;B1&&{ A2 19 26 23;B7 7;C3 23;};A2 18 26 23;B7 7;C3 24;A2 4 20 21;B7 6;B2 9;A4 14 7 52 9;B2 10;B6 9 10 4;C3 25;D13 4 21 24 26;B4 4 12 26;B3 4 13 27;A1 4 22 29;B7 12;B2 14;A4 14 6 52 14;B2 15;B6 14 15 4;B3 0 0 30;C3 29;A1 4 23 27;B7 13;C3 30;D13 24 24 32 31;D13 25 37 32 33;A2 23 18 28;B2 16;A2 16 25 33;B7 16;B3 0 0 34;B2 21;A6 47 21&&C0;B1&&{ D13 21 0 32 19;D13 10 42 32 40;D22 29 35 46 39;};D13 14 1 48 42;D12 34 43 53 44;D22 0 $((N1+8)) 51 32;D13 4 8 41 6;D12 26 28 35 34;D13 27 29 36 35;A2 27 32 39&&{ B2 19;A2 33 33 40;B2 20;B6 19 20 3;};C2 36;D23 33 34 42 37;B1&&D23 35 45 55 46;D23 32 31 43 38;D12 36 47 32 48;D13 20 42 32 41;D13 14 2 48 43;D13 4 5 32 1;D13 4 3 60 5;D12 26 48 49 49;B3 4 22 57;A1 26 46 56;B7 22;B3 0 0 58;C3 47;D22 4 4 50 0;D23 22 9 37 7;A7;C2 2;} 2>/dev/null|pbcopy;exit 2>&-
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    8. Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Click anywhere in the Terminal window and paste by pressing command-V. The text you pasted should vanish immediately. If it doesn't, press the return key.
    9. If you see an error message in the Terminal window such as "Syntax error" or "Event not found," enter
    exec bash
    and press return. Then paste the script again.
    10. If you're logged in as an administrator, you'll be prompted for your login password. Nothing will be displayed when you type it. You will not see the usual dots in place of typed characters. Make sure caps lock is off. Type carefully and then press return. You may get a one-time warning to be careful. If you make three failed attempts to enter the password, the test will run anyway, but it will produce less information. In most cases, the difference is not important. If you don't know the password, or if you prefer not to enter it, press the key combination control-C or just press return three times at the password prompt. Again, the script will still run.
    If you're not logged in as an administrator, you won't be prompted for a password. The test will still run. It just won't do anything that requires administrator privileges.
    11. The test may take a few minutes to run, depending on how many files you have and the speed of the computer. A computer that's abnormally slow may take longer to run the test. While it's running, there will be nothing in the Terminal window and no indication of progress. Wait for the line
    [Process completed]
    to appear. If you don't see it within half an hour or so, the test probably won't complete in a reasonable time. In that case, close the Terminal window and report the results. No harm will be done.
    12. When the test is complete, quit Terminal. The results will have been copied to the Clipboard automatically. They are not shown in the Terminal window. Please don't copy anything from there. All you have to do is start a reply to this comment and then paste by pressing command-V again.
    At the top of the results, there will be a line that begins with the words "Start Time." If you don't see that, but instead see a mass of gibberish, you didn't wait for the "Process completed" message to appear in the Terminal window. Please wait for it and try again.
    If any private information, such as your name or email address, appears in the results, anonymize it before posting. Usually that won't be necessary.
    13. When you post the results, you might see an error message on the web page: "You have included content in your post that is not permitted," or "You are not authorized to post." That's a bug in the forum software. Please post the test results on Pastebin, then post a link here to the page you created.
    14. This is a public forum, and others may give you advice based on the results of the test. They speak only for themselves, and I don't necessarily agree with them.
    Copyright © 2014 by Linc Davis. As the sole author of this work, I reserve all rights to it except as provided in the Use Agreement for the Apple Support Communities website ("ASC"). Readers of ASC may copy it for their own personal use. Neither the whole nor any part may be redistributed.

Maybe you are looking for