пятница, 15 декабря 2017 г.

Удаления старых ядер из Ubuntu

удалит все кроме 3х самых новых

 sudo apt-get install bikeshed
 sudo purge-old-kernels --keep 3


или


удалит все кроме 2х последних

sudo apt-get purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | head -n -1)

sudo apt-get autoclean
sudo apt-get autoremove


четверг, 7 сентября 2017 г.

Oracle SQL scripts for checking

SQL request 15 min

select a.user_id, d.username, s.sql_text, sum(a.wait_time + a.time_waited) total_wait_time from v$active_session_history a, v$sqlarea s, dba_users d where a.sample_time between sysdate-30/2880 and sysdate and a.sql_id = s.sql_id and a.user_id = d.user_id group by a.user_id, s.sql_text, d.username order by total_wait_time desc;


Object for 15 min

select o.owner, o.object_name, o.object_type, a.event, sum(a.wait_time + a.time_waited) total_wait_time from v$active_session_history a, dba_objects o where a.sample_time between sysdate-30/2880 and sysdate and a.current_obj# = o.object_id group by o.owner, o.object_name, o.object_type, a.event order by total_wait_time desc;





среда, 6 сентября 2017 г.

Oracle DB 12c и новый пользователь/схема

Имеем Oracle 12c и необходимо создать пользователя DEV. Из sql консоли:

CREATE USER DEV IDENTIFIED BY DEVPASS
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP
QUOTA 1000M ON USERS


если получили ошибку вида ORA-65096: invalid common user or role name in oracle.
надо выполнить
alter session set "_ORACLE_SCRIPT"=true; 

затем раздать нужные права

GRANT CREATE SESSION TO DEV
GRANT CREATE TABLE TO DEV
GRANT CREATE PROCEDURE TO DEV
GRANT CREATE TRIGGER TO DEV
GRANT CREATE VIEW TO DEV
GRANT CREATE SEQUENCE TO DEV
GRANT ALTER ANY TABLE TO DEV
GRANT ALTER ANY PROCEDURE TO DEV
GRANT ALTER ANY TRIGGER TO DEV
GRANT ALTER PROFILE TO DEV
GRANT DELETE ANY TABLE TO DEV
GRANT DROP ANY TABLE TO DEV
GRANT DROP ANY PROCEDURE TO DEV
GRANT DROP ANY TRIGGER TO DEV
GRANT DROP ANY VIEW TO DEV
GRANT DROP PROFILE TO DEV

можно изменять пользователя/схему

ALTER USER DEV IDENTIFIED BY NEWPASSWD;

ALTER USER DEV QUOTA UNLIMITED ON USERS;

понедельник, 4 сентября 2017 г.

Восстановление загрузки grub2

Грузимся с LiveCD, если есть lvm2 и они автоматически не подтянулись, активируем командой:
vgchange -a y

Если нет lvm модуля в LiveCD можно его установить:
apt-get install lvm2
modprobe dm-mod

Монтируем root
mount /dev/sda_х_ /mnt
и необходимые каталоги
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys

chroot /mnt
grub2-install /dev/sda

Lvm2 resize and Centos/Oracle

In Centos 7 / Oracle command:

resize2fs /dev/xxx/yyy
doesn't work with error
resize2fs: Bad magic number in super-block while trying to open /dev/xxx/yyy
Couldn't find valid filesystem superblock.
use

fasdm resize /dev/xxx/yyy

четверг, 31 августа 2017 г.

How to activate LVM2 on Live USB/CD

How to activate LVM2 on Live USB/CD

apt-get install lvm2
modprobe dm-mod
vgchange -a y

четверг, 20 апреля 2017 г.

(L)Ubuntu postinstall - Java and other

apt install aptitude mc openssh-server x2x libreoffice xscreensaver
apt install gcc make

win fonts
wget http://ftp.de.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.6_all.deb
sudo dpkg -i ttf-mscorefonts-installer_3.6_all.deb


LXDE / Lubuntu

apt-get purge `dpkg -l | awk '{print $2}' | grep -E 'gnome|unity'`
apt-get install lubuntu-desktop
apt-get autoremove

Java

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install maven gradle oracle-java8-installer 
add to /etc/environment or /etc/profile
JAVA_HOME=/usr/lib/jvm/java-8-oracle
reload in terminal: source /etc/environment

Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'

sudo apt-get update
sudo apt-get install google-chrome-stable

Fonts


~/.fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts.conf file to configure system font access -->
<fontconfig>
<!-- Antialias -->
<match target="font">
        <test qual="any" name="size" compare="more">
                <double>8</double>
        </test>
        <test qual="any" name="size" compare="less">
                <double>25</double>
        </test>
        <edit name="antialias" mode="assign">
                <bool>false</bool>
        </edit>
</match>


Idea
echo "fs.inotify.max_user_watches = 524288" >  /etc/sysctl.d/90-idea.conf
sudo sysctl -p --system

Maven issue "Loading archetype list..." : http://mldav.blogspot.com.by/2015/12/intellij-idea-loading-archetype-list.html
Build,Execution,Deployment → Build Tools → Maven → Importing need to set "VM options for importer = -Xmx1024m"


Programs crash notification

rm /var/crash/*
in file  /etc/default/apport  set enabled=0
service apport stop

Screen Locker and Screenshot
add to ~/.config/openbox/lubuntu-rc.xml

 <keybind key="W-l">
      <action name="Execute">
        <command>xscreensaver-command -lock</command>
      </action>
 </keybind>
  <!-- Take a screenshot of the current window with scrot when Alt+Print are pressed -->
  <keybind key="A-Print">
      <action name="Execute">
        <command>scrot --focused --border ~/Screenshots/%Y-%m-%d-%T-window-screenshot.png</command>
      </action>
  </keybind>
  <!-- Take a screenshot of the screen with scrot when Print are pressed -->
  <keybind key="Print">
      <action name="Execute">
        <command>scrot ~/Screenshots/%Y-%m-%d-%T-all-screenshot.png</command>
      </action>
  </keybind>
remove config for F11 - need to Idea

reload new config:
openbox --reconfigure

Printer HP

https://developers.hp.com/hp-linux-imaging-and-printing/gethplip
или
apt install cups hplip

Dual monitors
color for second monitor - adjust ~/.config/pcmanfm/lubuntu/desktop-items-1.conf  like desktop-items-0.conf
color login screen - change /etc/lightdm/lightdm-gtk-greeter.conf.d/30_lubuntu.conf 
background=#2e4060

sudo systemctl disable cups-browsed.service
Skype double icon
env XDG_CURRENT_DESKTOP=Unity

Thunderbird - missed icon
https://github.com/googlei18n/noto-emoji/raw/master/fonts/NotoEmoji-Regular.ttf - copy to /usr/share/fonts/truetype/noto